mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 07:38:37 +08:00 
			
		
		
		
	Merge branch 'actions:main' into patch-1
This commit is contained in:
		
						commit
						f238c072d2
					
				
							
								
								
									
										50
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
# `dist/index.js` is a special file in Actions.
 | 
			
		||||
# When you reference an action with `uses:` in a workflow,
 | 
			
		||||
# `index.js` is the code that will run.
 | 
			
		||||
# For our project, we generate this file through a build process
 | 
			
		||||
# from other source files.
 | 
			
		||||
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
 | 
			
		||||
name: Check dist/
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
    paths-ignore:
 | 
			
		||||
      - '**.md'
 | 
			
		||||
  pull_request:
 | 
			
		||||
    paths-ignore:
 | 
			
		||||
      - '**.md'
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  check-dist:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Set Node.js 12.x
 | 
			
		||||
        uses: actions/setup-node@v1
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 12.x
 | 
			
		||||
 | 
			
		||||
      - name: Install dependencies
 | 
			
		||||
        run: npm ci
 | 
			
		||||
 | 
			
		||||
      - name: Move the committed index.js file
 | 
			
		||||
        run: mv dist/ /tmp/
 | 
			
		||||
 | 
			
		||||
      - name: Rebuild the index.js file
 | 
			
		||||
        run: npm run build
 | 
			
		||||
 | 
			
		||||
      - name: Compare the expected and actual index.js files
 | 
			
		||||
        run: git diff --ignore-all-space dist/ /tmp/dist
 | 
			
		||||
        id: diff
 | 
			
		||||
 | 
			
		||||
      # If index.js was different than expected, upload the expected version as an artifact
 | 
			
		||||
      - uses: actions/upload-artifact@v2
 | 
			
		||||
        if: ${{ failure() && steps.diff.conclusion == 'failure' }}
 | 
			
		||||
        with:
 | 
			
		||||
          name: dist
 | 
			
		||||
          path: dist/
 | 
			
		||||
							
								
								
									
										10
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,8 +1,12 @@
 | 
			
		|||
name: Licensed
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push: {branches: main}
 | 
			
		||||
  pull_request: {branches: main}
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
| 
						 | 
				
			
			@ -17,4 +21,4 @@ jobs:
 | 
			
		|||
          curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
 | 
			
		||||
          sudo tar -xzf licensed.tar.gz
 | 
			
		||||
          sudo mv licensed /usr/local/bin/licensed
 | 
			
		||||
      - run: licensed status
 | 
			
		||||
      - run: licensed status
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ test("restore on GHES should no-op", async () => {
 | 
			
		|||
    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
			
		||||
    expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
 | 
			
		||||
    expect(logWarningMock).toHaveBeenCalledWith(
 | 
			
		||||
        "Cache action is not supported on GHES"
 | 
			
		||||
        "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
 | 
			
		||||
    );
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,7 +111,7 @@ test("save on GHES should no-op", async () => {
 | 
			
		|||
 | 
			
		||||
    expect(saveCacheMock).toHaveBeenCalledTimes(0);
 | 
			
		||||
    expect(logWarningMock).toHaveBeenCalledWith(
 | 
			
		||||
        "Cache action is not supported on GHES"
 | 
			
		||||
        "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
 | 
			
		||||
    );
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										394
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										394
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -5460,32 +5460,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		|||
/***/ (function(__unusedmodule, exports) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
 | 
			
		||||
var Inputs;
 | 
			
		||||
(function (Inputs) {
 | 
			
		||||
    Inputs["Key"] = "key";
 | 
			
		||||
    Inputs["Path"] = "path";
 | 
			
		||||
    Inputs["RestoreKeys"] = "restore-keys";
 | 
			
		||||
    Inputs["UploadChunkSize"] = "upload-chunk-size";
 | 
			
		||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
 | 
			
		||||
var Outputs;
 | 
			
		||||
(function (Outputs) {
 | 
			
		||||
    Outputs["CacheHit"] = "cache-hit";
 | 
			
		||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
			
		||||
var State;
 | 
			
		||||
(function (State) {
 | 
			
		||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
			
		||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
			
		||||
})(State = exports.State || (exports.State = {}));
 | 
			
		||||
var Events;
 | 
			
		||||
(function (Events) {
 | 
			
		||||
    Events["Key"] = "GITHUB_EVENT_NAME";
 | 
			
		||||
    Events["Push"] = "push";
 | 
			
		||||
    Events["PullRequest"] = "pull_request";
 | 
			
		||||
})(Events = exports.Events || (exports.Events = {}));
 | 
			
		||||
exports.RefKey = "GITHUB_REF";
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
 | 
			
		||||
var Inputs;
 | 
			
		||||
(function (Inputs) {
 | 
			
		||||
    Inputs["Key"] = "key";
 | 
			
		||||
    Inputs["Path"] = "path";
 | 
			
		||||
    Inputs["RestoreKeys"] = "restore-keys";
 | 
			
		||||
    Inputs["UploadChunkSize"] = "upload-chunk-size";
 | 
			
		||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
 | 
			
		||||
var Outputs;
 | 
			
		||||
(function (Outputs) {
 | 
			
		||||
    Outputs["CacheHit"] = "cache-hit";
 | 
			
		||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
			
		||||
var State;
 | 
			
		||||
(function (State) {
 | 
			
		||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
			
		||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
			
		||||
})(State = exports.State || (exports.State = {}));
 | 
			
		||||
var Events;
 | 
			
		||||
(function (Events) {
 | 
			
		||||
    Events["Key"] = "GITHUB_EVENT_NAME";
 | 
			
		||||
    Events["Push"] = "push";
 | 
			
		||||
    Events["PullRequest"] = "pull_request";
 | 
			
		||||
})(Events = exports.Events || (exports.Events = {}));
 | 
			
		||||
exports.RefKey = "GITHUB_REF";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
| 
						 | 
				
			
			@ -38691,92 +38691,92 @@ exports.default = {
 | 
			
		|||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
function isGhes() {
 | 
			
		||||
    const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
 | 
			
		||||
    return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isExactKeyMatch(key, cacheKey) {
 | 
			
		||||
    return !!(cacheKey &&
 | 
			
		||||
        cacheKey.localeCompare(key, undefined, {
 | 
			
		||||
            sensitivity: "accent"
 | 
			
		||||
        }) === 0);
 | 
			
		||||
}
 | 
			
		||||
exports.isExactKeyMatch = isExactKeyMatch;
 | 
			
		||||
function setCacheState(state) {
 | 
			
		||||
    core.saveState(constants_1.State.CacheMatchedKey, state);
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheState = setCacheState;
 | 
			
		||||
function setCacheHitOutput(isCacheHit) {
 | 
			
		||||
    core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString());
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheHitOutput = setCacheHitOutput;
 | 
			
		||||
function setOutputAndState(key, cacheKey) {
 | 
			
		||||
    setCacheHitOutput(isExactKeyMatch(key, cacheKey));
 | 
			
		||||
    // Store the matched cache key if it exists
 | 
			
		||||
    cacheKey && setCacheState(cacheKey);
 | 
			
		||||
}
 | 
			
		||||
exports.setOutputAndState = setOutputAndState;
 | 
			
		||||
function getCacheState() {
 | 
			
		||||
    const cacheKey = core.getState(constants_1.State.CacheMatchedKey);
 | 
			
		||||
    if (cacheKey) {
 | 
			
		||||
        core.debug(`Cache state/key: ${cacheKey}`);
 | 
			
		||||
        return cacheKey;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
}
 | 
			
		||||
exports.getCacheState = getCacheState;
 | 
			
		||||
function logWarning(message) {
 | 
			
		||||
    const warningPrefix = "[warning]";
 | 
			
		||||
    core.info(`${warningPrefix}${message}`);
 | 
			
		||||
}
 | 
			
		||||
exports.logWarning = logWarning;
 | 
			
		||||
// Cache token authorized for all events that are tied to a ref
 | 
			
		||||
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
 | 
			
		||||
function isValidEvent() {
 | 
			
		||||
    return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
 | 
			
		||||
}
 | 
			
		||||
exports.isValidEvent = isValidEvent;
 | 
			
		||||
function getInputAsArray(name, options) {
 | 
			
		||||
    return core
 | 
			
		||||
        .getInput(name, options)
 | 
			
		||||
        .split("\n")
 | 
			
		||||
        .map(s => s.trim())
 | 
			
		||||
        .filter(x => x !== "");
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsArray = getInputAsArray;
 | 
			
		||||
function getInputAsInt(name, options) {
 | 
			
		||||
    const value = parseInt(core.getInput(name, options));
 | 
			
		||||
    if (isNaN(value) || value < 0) {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsInt = getInputAsInt;
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
function isGhes() {
 | 
			
		||||
    const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
 | 
			
		||||
    return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isExactKeyMatch(key, cacheKey) {
 | 
			
		||||
    return !!(cacheKey &&
 | 
			
		||||
        cacheKey.localeCompare(key, undefined, {
 | 
			
		||||
            sensitivity: "accent"
 | 
			
		||||
        }) === 0);
 | 
			
		||||
}
 | 
			
		||||
exports.isExactKeyMatch = isExactKeyMatch;
 | 
			
		||||
function setCacheState(state) {
 | 
			
		||||
    core.saveState(constants_1.State.CacheMatchedKey, state);
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheState = setCacheState;
 | 
			
		||||
function setCacheHitOutput(isCacheHit) {
 | 
			
		||||
    core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString());
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheHitOutput = setCacheHitOutput;
 | 
			
		||||
function setOutputAndState(key, cacheKey) {
 | 
			
		||||
    setCacheHitOutput(isExactKeyMatch(key, cacheKey));
 | 
			
		||||
    // Store the matched cache key if it exists
 | 
			
		||||
    cacheKey && setCacheState(cacheKey);
 | 
			
		||||
}
 | 
			
		||||
exports.setOutputAndState = setOutputAndState;
 | 
			
		||||
function getCacheState() {
 | 
			
		||||
    const cacheKey = core.getState(constants_1.State.CacheMatchedKey);
 | 
			
		||||
    if (cacheKey) {
 | 
			
		||||
        core.debug(`Cache state/key: ${cacheKey}`);
 | 
			
		||||
        return cacheKey;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
}
 | 
			
		||||
exports.getCacheState = getCacheState;
 | 
			
		||||
function logWarning(message) {
 | 
			
		||||
    const warningPrefix = "[warning]";
 | 
			
		||||
    core.info(`${warningPrefix}${message}`);
 | 
			
		||||
}
 | 
			
		||||
exports.logWarning = logWarning;
 | 
			
		||||
// Cache token authorized for all events that are tied to a ref
 | 
			
		||||
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
 | 
			
		||||
function isValidEvent() {
 | 
			
		||||
    return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
 | 
			
		||||
}
 | 
			
		||||
exports.isValidEvent = isValidEvent;
 | 
			
		||||
function getInputAsArray(name, options) {
 | 
			
		||||
    return core
 | 
			
		||||
        .getInput(name, options)
 | 
			
		||||
        .split("\n")
 | 
			
		||||
        .map(s => s.trim())
 | 
			
		||||
        .filter(x => x !== "");
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsArray = getInputAsArray;
 | 
			
		||||
function getInputAsInt(name, options) {
 | 
			
		||||
    const value = parseInt(core.getInput(name, options));
 | 
			
		||||
    if (isNaN(value) || value < 0) {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsInt = getInputAsInt;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
| 
						 | 
				
			
			@ -49180,91 +49180,91 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		|||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
const utils = __importStar(__webpack_require__(443));
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            if (utils.isGhes()) {
 | 
			
		||||
                utils.logWarning("Cache action is not supported on GHES");
 | 
			
		||||
                utils.setCacheHitOutput(false);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            // Validate inputs, this can cause task failure
 | 
			
		||||
            if (!utils.isValidEvent()) {
 | 
			
		||||
                utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const primaryKey = core.getInput(constants_1.Inputs.Key, { required: true });
 | 
			
		||||
            core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
 | 
			
		||||
            const restoreKeys = utils.getInputAsArray(constants_1.Inputs.RestoreKeys);
 | 
			
		||||
            const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
 | 
			
		||||
                required: true
 | 
			
		||||
            });
 | 
			
		||||
            try {
 | 
			
		||||
                const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys);
 | 
			
		||||
                if (!cacheKey) {
 | 
			
		||||
                    core.info(`Cache not found for input keys: ${[
 | 
			
		||||
                        primaryKey,
 | 
			
		||||
                        ...restoreKeys
 | 
			
		||||
                    ].join(", ")}`);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                // Store the matched cache key
 | 
			
		||||
                utils.setCacheState(cacheKey);
 | 
			
		||||
                const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
 | 
			
		||||
                utils.setCacheHitOutput(isExactKeyMatch);
 | 
			
		||||
                core.info(`Cache restored from key: ${cacheKey}`);
 | 
			
		||||
            }
 | 
			
		||||
            catch (error) {
 | 
			
		||||
                if (error.name === cache.ValidationError.name) {
 | 
			
		||||
                    throw error;
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    utils.logWarning(error.message);
 | 
			
		||||
                    utils.setCacheHitOutput(false);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            core.setFailed(error.message);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
run();
 | 
			
		||||
exports.default = run;
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
const utils = __importStar(__webpack_require__(443));
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            if (utils.isGhes()) {
 | 
			
		||||
                utils.logWarning("Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details");
 | 
			
		||||
                utils.setCacheHitOutput(false);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            // Validate inputs, this can cause task failure
 | 
			
		||||
            if (!utils.isValidEvent()) {
 | 
			
		||||
                utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const primaryKey = core.getInput(constants_1.Inputs.Key, { required: true });
 | 
			
		||||
            core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
 | 
			
		||||
            const restoreKeys = utils.getInputAsArray(constants_1.Inputs.RestoreKeys);
 | 
			
		||||
            const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
 | 
			
		||||
                required: true
 | 
			
		||||
            });
 | 
			
		||||
            try {
 | 
			
		||||
                const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys);
 | 
			
		||||
                if (!cacheKey) {
 | 
			
		||||
                    core.info(`Cache not found for input keys: ${[
 | 
			
		||||
                        primaryKey,
 | 
			
		||||
                        ...restoreKeys
 | 
			
		||||
                    ].join(", ")}`);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                // Store the matched cache key
 | 
			
		||||
                utils.setCacheState(cacheKey);
 | 
			
		||||
                const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
 | 
			
		||||
                utils.setCacheHitOutput(isExactKeyMatch);
 | 
			
		||||
                core.info(`Cache restored from key: ${cacheKey}`);
 | 
			
		||||
            }
 | 
			
		||||
            catch (error) {
 | 
			
		||||
                if (error.name === cache.ValidationError.name) {
 | 
			
		||||
                    throw error;
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    utils.logWarning(error.message);
 | 
			
		||||
                    utils.setCacheHitOutput(false);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            core.setFailed(error.message);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
run();
 | 
			
		||||
exports.default = run;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										400
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										400
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -5460,32 +5460,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		|||
/***/ (function(__unusedmodule, exports) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
 | 
			
		||||
var Inputs;
 | 
			
		||||
(function (Inputs) {
 | 
			
		||||
    Inputs["Key"] = "key";
 | 
			
		||||
    Inputs["Path"] = "path";
 | 
			
		||||
    Inputs["RestoreKeys"] = "restore-keys";
 | 
			
		||||
    Inputs["UploadChunkSize"] = "upload-chunk-size";
 | 
			
		||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
 | 
			
		||||
var Outputs;
 | 
			
		||||
(function (Outputs) {
 | 
			
		||||
    Outputs["CacheHit"] = "cache-hit";
 | 
			
		||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
			
		||||
var State;
 | 
			
		||||
(function (State) {
 | 
			
		||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
			
		||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
			
		||||
})(State = exports.State || (exports.State = {}));
 | 
			
		||||
var Events;
 | 
			
		||||
(function (Events) {
 | 
			
		||||
    Events["Key"] = "GITHUB_EVENT_NAME";
 | 
			
		||||
    Events["Push"] = "push";
 | 
			
		||||
    Events["PullRequest"] = "pull_request";
 | 
			
		||||
})(Events = exports.Events || (exports.Events = {}));
 | 
			
		||||
exports.RefKey = "GITHUB_REF";
 | 
			
		||||
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.RefKey = exports.Events = exports.State = exports.Outputs = exports.Inputs = void 0;
 | 
			
		||||
var Inputs;
 | 
			
		||||
(function (Inputs) {
 | 
			
		||||
    Inputs["Key"] = "key";
 | 
			
		||||
    Inputs["Path"] = "path";
 | 
			
		||||
    Inputs["RestoreKeys"] = "restore-keys";
 | 
			
		||||
    Inputs["UploadChunkSize"] = "upload-chunk-size";
 | 
			
		||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
 | 
			
		||||
var Outputs;
 | 
			
		||||
(function (Outputs) {
 | 
			
		||||
    Outputs["CacheHit"] = "cache-hit";
 | 
			
		||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
 | 
			
		||||
var State;
 | 
			
		||||
(function (State) {
 | 
			
		||||
    State["CachePrimaryKey"] = "CACHE_KEY";
 | 
			
		||||
    State["CacheMatchedKey"] = "CACHE_RESULT";
 | 
			
		||||
})(State = exports.State || (exports.State = {}));
 | 
			
		||||
var Events;
 | 
			
		||||
(function (Events) {
 | 
			
		||||
    Events["Key"] = "GITHUB_EVENT_NAME";
 | 
			
		||||
    Events["Push"] = "push";
 | 
			
		||||
    Events["PullRequest"] = "pull_request";
 | 
			
		||||
})(Events = exports.Events || (exports.Events = {}));
 | 
			
		||||
exports.RefKey = "GITHUB_REF";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
| 
						 | 
				
			
			@ -38691,92 +38691,92 @@ exports.default = {
 | 
			
		|||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
function isGhes() {
 | 
			
		||||
    const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
 | 
			
		||||
    return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isExactKeyMatch(key, cacheKey) {
 | 
			
		||||
    return !!(cacheKey &&
 | 
			
		||||
        cacheKey.localeCompare(key, undefined, {
 | 
			
		||||
            sensitivity: "accent"
 | 
			
		||||
        }) === 0);
 | 
			
		||||
}
 | 
			
		||||
exports.isExactKeyMatch = isExactKeyMatch;
 | 
			
		||||
function setCacheState(state) {
 | 
			
		||||
    core.saveState(constants_1.State.CacheMatchedKey, state);
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheState = setCacheState;
 | 
			
		||||
function setCacheHitOutput(isCacheHit) {
 | 
			
		||||
    core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString());
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheHitOutput = setCacheHitOutput;
 | 
			
		||||
function setOutputAndState(key, cacheKey) {
 | 
			
		||||
    setCacheHitOutput(isExactKeyMatch(key, cacheKey));
 | 
			
		||||
    // Store the matched cache key if it exists
 | 
			
		||||
    cacheKey && setCacheState(cacheKey);
 | 
			
		||||
}
 | 
			
		||||
exports.setOutputAndState = setOutputAndState;
 | 
			
		||||
function getCacheState() {
 | 
			
		||||
    const cacheKey = core.getState(constants_1.State.CacheMatchedKey);
 | 
			
		||||
    if (cacheKey) {
 | 
			
		||||
        core.debug(`Cache state/key: ${cacheKey}`);
 | 
			
		||||
        return cacheKey;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
}
 | 
			
		||||
exports.getCacheState = getCacheState;
 | 
			
		||||
function logWarning(message) {
 | 
			
		||||
    const warningPrefix = "[warning]";
 | 
			
		||||
    core.info(`${warningPrefix}${message}`);
 | 
			
		||||
}
 | 
			
		||||
exports.logWarning = logWarning;
 | 
			
		||||
// Cache token authorized for all events that are tied to a ref
 | 
			
		||||
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
 | 
			
		||||
function isValidEvent() {
 | 
			
		||||
    return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
 | 
			
		||||
}
 | 
			
		||||
exports.isValidEvent = isValidEvent;
 | 
			
		||||
function getInputAsArray(name, options) {
 | 
			
		||||
    return core
 | 
			
		||||
        .getInput(name, options)
 | 
			
		||||
        .split("\n")
 | 
			
		||||
        .map(s => s.trim())
 | 
			
		||||
        .filter(x => x !== "");
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsArray = getInputAsArray;
 | 
			
		||||
function getInputAsInt(name, options) {
 | 
			
		||||
    const value = parseInt(core.getInput(name, options));
 | 
			
		||||
    if (isNaN(value) || value < 0) {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsInt = getInputAsInt;
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.getInputAsInt = exports.getInputAsArray = exports.isValidEvent = exports.logWarning = exports.getCacheState = exports.setOutputAndState = exports.setCacheHitOutput = exports.setCacheState = exports.isExactKeyMatch = exports.isGhes = void 0;
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
function isGhes() {
 | 
			
		||||
    const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
 | 
			
		||||
    return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
 | 
			
		||||
}
 | 
			
		||||
exports.isGhes = isGhes;
 | 
			
		||||
function isExactKeyMatch(key, cacheKey) {
 | 
			
		||||
    return !!(cacheKey &&
 | 
			
		||||
        cacheKey.localeCompare(key, undefined, {
 | 
			
		||||
            sensitivity: "accent"
 | 
			
		||||
        }) === 0);
 | 
			
		||||
}
 | 
			
		||||
exports.isExactKeyMatch = isExactKeyMatch;
 | 
			
		||||
function setCacheState(state) {
 | 
			
		||||
    core.saveState(constants_1.State.CacheMatchedKey, state);
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheState = setCacheState;
 | 
			
		||||
function setCacheHitOutput(isCacheHit) {
 | 
			
		||||
    core.setOutput(constants_1.Outputs.CacheHit, isCacheHit.toString());
 | 
			
		||||
}
 | 
			
		||||
exports.setCacheHitOutput = setCacheHitOutput;
 | 
			
		||||
function setOutputAndState(key, cacheKey) {
 | 
			
		||||
    setCacheHitOutput(isExactKeyMatch(key, cacheKey));
 | 
			
		||||
    // Store the matched cache key if it exists
 | 
			
		||||
    cacheKey && setCacheState(cacheKey);
 | 
			
		||||
}
 | 
			
		||||
exports.setOutputAndState = setOutputAndState;
 | 
			
		||||
function getCacheState() {
 | 
			
		||||
    const cacheKey = core.getState(constants_1.State.CacheMatchedKey);
 | 
			
		||||
    if (cacheKey) {
 | 
			
		||||
        core.debug(`Cache state/key: ${cacheKey}`);
 | 
			
		||||
        return cacheKey;
 | 
			
		||||
    }
 | 
			
		||||
    return undefined;
 | 
			
		||||
}
 | 
			
		||||
exports.getCacheState = getCacheState;
 | 
			
		||||
function logWarning(message) {
 | 
			
		||||
    const warningPrefix = "[warning]";
 | 
			
		||||
    core.info(`${warningPrefix}${message}`);
 | 
			
		||||
}
 | 
			
		||||
exports.logWarning = logWarning;
 | 
			
		||||
// Cache token authorized for all events that are tied to a ref
 | 
			
		||||
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
 | 
			
		||||
function isValidEvent() {
 | 
			
		||||
    return constants_1.RefKey in process.env && Boolean(process.env[constants_1.RefKey]);
 | 
			
		||||
}
 | 
			
		||||
exports.isValidEvent = isValidEvent;
 | 
			
		||||
function getInputAsArray(name, options) {
 | 
			
		||||
    return core
 | 
			
		||||
        .getInput(name, options)
 | 
			
		||||
        .split("\n")
 | 
			
		||||
        .map(s => s.trim())
 | 
			
		||||
        .filter(x => x !== "");
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsArray = getInputAsArray;
 | 
			
		||||
function getInputAsInt(name, options) {
 | 
			
		||||
    const value = parseInt(core.getInput(name, options));
 | 
			
		||||
    if (isNaN(value) || value < 0) {
 | 
			
		||||
        return undefined;
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
}
 | 
			
		||||
exports.getInputAsInt = getInputAsInt;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
| 
						 | 
				
			
			@ -47120,94 +47120,94 @@ exports.default = _default;
 | 
			
		|||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
const utils = __importStar(__webpack_require__(443));
 | 
			
		||||
// Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | 
			
		||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | 
			
		||||
// throw an uncaught exception.  Instead of failing this action, just warn.
 | 
			
		||||
process.on("uncaughtException", e => utils.logWarning(e.message));
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            if (utils.isGhes()) {
 | 
			
		||||
                utils.logWarning("Cache action is not supported on GHES");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (!utils.isValidEvent()) {
 | 
			
		||||
                utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const state = utils.getCacheState();
 | 
			
		||||
            // Inputs are re-evaluted before the post action, so we want the original key used for restore
 | 
			
		||||
            const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
 | 
			
		||||
            if (!primaryKey) {
 | 
			
		||||
                utils.logWarning(`Error retrieving key from state.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (utils.isExactKeyMatch(primaryKey, state)) {
 | 
			
		||||
                core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
 | 
			
		||||
                required: true
 | 
			
		||||
            });
 | 
			
		||||
            try {
 | 
			
		||||
                yield cache.saveCache(cachePaths, primaryKey, {
 | 
			
		||||
                    uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
 | 
			
		||||
                });
 | 
			
		||||
                core.info(`Cache saved with key: ${primaryKey}`);
 | 
			
		||||
            }
 | 
			
		||||
            catch (error) {
 | 
			
		||||
                if (error.name === cache.ValidationError.name) {
 | 
			
		||||
                    throw error;
 | 
			
		||||
                }
 | 
			
		||||
                else if (error.name === cache.ReserveCacheError.name) {
 | 
			
		||||
                    core.info(error.message);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    utils.logWarning(error.message);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            utils.logWarning(error.message);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
run();
 | 
			
		||||
exports.default = run;
 | 
			
		||||
 | 
			
		||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
 | 
			
		||||
}) : (function(o, m, k, k2) {
 | 
			
		||||
    if (k2 === undefined) k2 = k;
 | 
			
		||||
    o[k2] = m[k];
 | 
			
		||||
}));
 | 
			
		||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
 | 
			
		||||
    Object.defineProperty(o, "default", { enumerable: true, value: v });
 | 
			
		||||
}) : function(o, v) {
 | 
			
		||||
    o["default"] = v;
 | 
			
		||||
});
 | 
			
		||||
var __importStar = (this && this.__importStar) || function (mod) {
 | 
			
		||||
    if (mod && mod.__esModule) return mod;
 | 
			
		||||
    var result = {};
 | 
			
		||||
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
 | 
			
		||||
    __setModuleDefault(result, mod);
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
 | 
			
		||||
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
 | 
			
		||||
    return new (P || (P = Promise))(function (resolve, reject) {
 | 
			
		||||
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
 | 
			
		||||
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
 | 
			
		||||
        step((generator = generator.apply(thisArg, _arguments || [])).next());
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const cache = __importStar(__webpack_require__(692));
 | 
			
		||||
const core = __importStar(__webpack_require__(470));
 | 
			
		||||
const constants_1 = __webpack_require__(196);
 | 
			
		||||
const utils = __importStar(__webpack_require__(443));
 | 
			
		||||
// Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | 
			
		||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | 
			
		||||
// throw an uncaught exception.  Instead of failing this action, just warn.
 | 
			
		||||
process.on("uncaughtException", e => utils.logWarning(e.message));
 | 
			
		||||
function run() {
 | 
			
		||||
    return __awaiter(this, void 0, void 0, function* () {
 | 
			
		||||
        try {
 | 
			
		||||
            if (utils.isGhes()) {
 | 
			
		||||
                utils.logWarning("Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (!utils.isValidEvent()) {
 | 
			
		||||
                utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const state = utils.getCacheState();
 | 
			
		||||
            // Inputs are re-evaluted before the post action, so we want the original key used for restore
 | 
			
		||||
            const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
 | 
			
		||||
            if (!primaryKey) {
 | 
			
		||||
                utils.logWarning(`Error retrieving key from state.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (utils.isExactKeyMatch(primaryKey, state)) {
 | 
			
		||||
                core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const cachePaths = utils.getInputAsArray(constants_1.Inputs.Path, {
 | 
			
		||||
                required: true
 | 
			
		||||
            });
 | 
			
		||||
            try {
 | 
			
		||||
                yield cache.saveCache(cachePaths, primaryKey, {
 | 
			
		||||
                    uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize)
 | 
			
		||||
                });
 | 
			
		||||
                core.info(`Cache saved with key: ${primaryKey}`);
 | 
			
		||||
            }
 | 
			
		||||
            catch (error) {
 | 
			
		||||
                if (error.name === cache.ValidationError.name) {
 | 
			
		||||
                    throw error;
 | 
			
		||||
                }
 | 
			
		||||
                else if (error.name === cache.ReserveCacheError.name) {
 | 
			
		||||
                    core.info(error.message);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    utils.logWarning(error.message);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (error) {
 | 
			
		||||
            utils.logWarning(error.message);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
run();
 | 
			
		||||
exports.default = run;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/***/ }),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										11
									
								
								examples.md
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								examples.md
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -451,12 +451,17 @@ jobs:
 | 
			
		|||
## Python - pipenv
 | 
			
		||||
 | 
			
		||||
```yaml
 | 
			
		||||
- name: Set up Python
 | 
			
		||||
  # The actions/cache step below uses this id to get the exact python version
 | 
			
		||||
  id: setup-python
 | 
			
		||||
  uses: actions/setup-python@v2
 | 
			
		||||
 | 
			
		||||
  ⋮
 | 
			
		||||
 | 
			
		||||
- uses: actions/cache@v2
 | 
			
		||||
  with:
 | 
			
		||||
    path: ~/.local/share/virtualenvs
 | 
			
		||||
    key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }}
 | 
			
		||||
    restore-keys: |
 | 
			
		||||
      ${{ runner.os }}-pipenv-
 | 
			
		||||
    key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## R - renv
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| 
						 | 
				
			
			@ -6473,9 +6473,9 @@
 | 
			
		|||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "ws": {
 | 
			
		||||
      "version": "5.2.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
 | 
			
		||||
      "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
 | 
			
		||||
      "version": "5.2.3",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz",
 | 
			
		||||
      "integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==",
 | 
			
		||||
      "dev": true,
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "async-limiter": "~1.0.0"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,9 @@ import * as utils from "./utils/actionUtils";
 | 
			
		|||
async function run(): Promise<void> {
 | 
			
		||||
    try {
 | 
			
		||||
        if (utils.isGhes()) {
 | 
			
		||||
            utils.logWarning("Cache action is not supported on GHES");
 | 
			
		||||
            utils.logWarning(
 | 
			
		||||
                "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
 | 
			
		||||
            );
 | 
			
		||||
            utils.setCacheHitOutput(false);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,7 +12,9 @@ process.on("uncaughtException", e => utils.logWarning(e.message));
 | 
			
		|||
async function run(): Promise<void> {
 | 
			
		||||
    try {
 | 
			
		||||
        if (utils.isGhes()) {
 | 
			
		||||
            utils.logWarning("Cache action is not supported on GHES");
 | 
			
		||||
            utils.logWarning(
 | 
			
		||||
                "Cache action is not supported on GHES. See https://github.com/actions/cache/issues/505 for more details"
 | 
			
		||||
            );
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user