mirror of https://github.com/actions/cache.git
Compare commits
27 Commits
dbc91afe92
...
6629bae72c
Author | SHA1 | Date |
---|---|---|
Eman Resu | 6629bae72c | |
Bassem Dghaidi | acc9ae5c14 | |
Bassem Dghaidi | cc679ff3ba | |
Bassem Dghaidi | 366d43d6f8 | |
dependabot[bot] | 02bf31969b | |
Bassem Dghaidi | 6f6220be5a | |
Bassem Dghaidi | ebdd24ede1 | |
dependabot[bot] | 255c8ff306 | |
Bassem Dghaidi | 010f24cd9d | |
Bassem Dghaidi | d6151ba7db | |
dependabot[bot] | 4ca7071576 | |
dependabot[bot] | 5d692d65f4 | |
Bassem Dghaidi | 3aef79d3a3 | |
Bassem Dghaidi | 772385291f | |
Bassem Dghaidi | e5dc90df92 | |
dependabot[bot] | 8585f2ac5c | |
Bassem Dghaidi | 9803087a86 | |
John Wesley Walker III | e7e2547a88 | |
John Wesley Walker III | 71d826cc33 | |
John Wesley Walker III | 25942a73ac | |
John Wesley Walker III | d73025053b | |
Ella Kramer | fa8c252a0b | |
Ella Kramer | b0a3f6e7a6 | |
Ella Kramer | 12b3b8a0b8 | |
Ella Kramer | 9806e2f37f | |
Ella Kramer | b3f0756597 | |
Ella Kramer | b6cff214f7 |
|
@ -0,0 +1,22 @@
|
||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
groups:
|
||||||
|
minor-actions-dependencies:
|
||||||
|
update-types: [minor, patch]
|
||||||
|
|
||||||
|
- package-ecosystem: "npm"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
allow:
|
||||||
|
- dependency-type: direct
|
||||||
|
- dependency-type: production
|
|
@ -10,7 +10,7 @@ jobs:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v3
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
days-before-issue-stale: 200
|
days-before-issue-stale: 200
|
||||||
days-before-issue-close: 5
|
days-before-issue-close: 5
|
||||||
|
|
|
@ -17,11 +17,11 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
# Override language selection by uncommenting this and choosing your languages
|
||||||
# with:
|
# with:
|
||||||
# languages: go, javascript, csharp, python, cpp, java, ruby
|
# languages: go, javascript, csharp, python, cpp, java, ruby
|
||||||
|
@ -29,7 +29,7 @@ jobs:
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below).
|
# If this step fails, then you should remove it and run the build manually (see below).
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
@ -43,4 +43,4 @@ jobs:
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|
|
@ -20,9 +20,9 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Setup Node.js 20.x
|
- name: Setup Node.js 20.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
node-version: 20.x
|
||||||
cache: npm
|
cache: npm
|
||||||
|
@ -43,7 +43,7 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Generate files in working directory
|
- name: Generate files in working directory
|
||||||
shell: bash
|
shell: bash
|
||||||
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
|
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
|
||||||
|
@ -66,7 +66,7 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Restore cache
|
- name: Restore cache
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -96,7 +96,7 @@ jobs:
|
||||||
https_proxy: http://squid-proxy:3128
|
https_proxy: http://squid-proxy:3128
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Generate files
|
- name: Generate files
|
||||||
run: __tests__/create-cache-files.sh proxy test-cache
|
run: __tests__/create-cache-files.sh proxy test-cache
|
||||||
- name: Save cache
|
- name: Save cache
|
||||||
|
@ -119,7 +119,7 @@ jobs:
|
||||||
https_proxy: http://squid-proxy:3128
|
https_proxy: http://squid-proxy:3128
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Restore cache
|
- name: Restore cache
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -8,17 +8,26 @@ import * as testUtils from "../src/utils/testUtils";
|
||||||
jest.mock("@actions/core");
|
jest.mock("@actions/core");
|
||||||
jest.mock("@actions/cache");
|
jest.mock("@actions/cache");
|
||||||
|
|
||||||
|
let pristineEnv: NodeJS.ProcessEnv;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
pristineEnv = process.env;
|
||||||
jest.spyOn(core, "getInput").mockImplementation((name, options) => {
|
jest.spyOn(core, "getInput").mockImplementation((name, options) => {
|
||||||
return jest.requireActual("@actions/core").getInput(name, options);
|
return jest.requireActual("@actions/core").getInput(name, options);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
beforeEach(() => {
|
||||||
|
jest.resetModules();
|
||||||
|
process.env = pristineEnv;
|
||||||
delete process.env[Events.Key];
|
delete process.env[Events.Key];
|
||||||
delete process.env[RefKey];
|
delete process.env[RefKey];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
process.env = pristineEnv;
|
||||||
|
});
|
||||||
|
|
||||||
test("isGhes returns true if server url is not github.com", () => {
|
test("isGhes returns true if server url is not github.com", () => {
|
||||||
try {
|
try {
|
||||||
process.env["GITHUB_SERVER_URL"] = "http://example.com";
|
process.env["GITHUB_SERVER_URL"] = "http://example.com";
|
||||||
|
@ -231,3 +240,28 @@ test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
|
||||||
delete process.env["GITHUB_SERVER_URL"];
|
delete process.env["GITHUB_SERVER_URL"];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("isGhes returns false when the GITHUB_SERVER_URL environment variable is not defined", async () => {
|
||||||
|
delete process.env["GITHUB_SERVER_URL"];
|
||||||
|
expect(actionUtils.isGhes()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("isGhes returns false when the GITHUB_SERVER_URL environment variable is set to github.com", async () => {
|
||||||
|
process.env["GITHUB_SERVER_URL"] = "https://github.com";
|
||||||
|
expect(actionUtils.isGhes()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("isGhes returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL", async () => {
|
||||||
|
process.env["GITHUB_SERVER_URL"] = "https://contoso.ghe.com";
|
||||||
|
expect(actionUtils.isGhes()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("isGhes returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix", async () => {
|
||||||
|
process.env["GITHUB_SERVER_URL"] = "https://mock-github.localhost";
|
||||||
|
expect(actionUtils.isGhes()).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("isGhes returns true when the GITHUB_SERVER_URL environment variable is set to some other URL", async () => {
|
||||||
|
process.env["GITHUB_SERVER_URL"] = "https://src.onpremise.fabrikam.com";
|
||||||
|
expect(actionUtils.isGhes()).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
|
@ -85,7 +85,8 @@ test("restore with no cache found", async () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(1);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(2);
|
||||||
|
|
||||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
@ -128,7 +129,8 @@ test("restore with restore keys and no cache found", async () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(1);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(2);
|
||||||
|
|
||||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
|
@ -171,7 +173,8 @@ test("restore with cache found for key", async () => {
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", key);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(2);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(3);
|
||||||
|
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
|
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
|
||||||
|
@ -216,7 +219,8 @@ test("restore with cache found for restore key", async () => {
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", restoreKey);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", restoreKey);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(2);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(3);
|
||||||
|
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
|
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
|
||||||
|
@ -304,7 +308,8 @@ test("restore when fail on cache miss is enabled and primary key doesn't match r
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", restoreKey);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", restoreKey);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(2);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(3);
|
||||||
|
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
|
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
|
||||||
|
@ -349,7 +354,8 @@ test("restore with fail on cache miss disabled and no cache found", async () =>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(1);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(2);
|
||||||
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(
|
expect(infoMock).toHaveBeenCalledWith(
|
||||||
`Cache not found for input keys: ${key}, ${restoreKey}`
|
`Cache not found for input keys: ${key}, ${restoreKey}`
|
||||||
|
|
|
@ -439,7 +439,8 @@ test("restore with lookup-only set", async () => {
|
||||||
|
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
|
||||||
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", key);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_RESULT", key);
|
||||||
expect(stateMock).toHaveBeenCalledTimes(2);
|
expect(stateMock).toHaveBeenCalledWith("CACHE_PATH", path);
|
||||||
|
expect(stateMock).toHaveBeenCalledTimes(3);
|
||||||
|
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
|
expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
|
||||||
|
|
|
@ -86,7 +86,8 @@ test("restore with no cache found", async () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||||
expect(outputMock).toHaveBeenCalledTimes(1);
|
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
|
||||||
|
expect(outputMock).toHaveBeenCalledTimes(2);
|
||||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(
|
expect(infoMock).toHaveBeenCalledWith(
|
||||||
|
@ -128,6 +129,7 @@ test("restore with restore keys and no cache found", async () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||||
|
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
|
||||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||||
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(
|
expect(infoMock).toHaveBeenCalledWith(
|
||||||
|
@ -169,8 +171,9 @@ test("restore with cache found for key", async () => {
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-hit", "true");
|
expect(outputMock).toHaveBeenCalledWith("cache-hit", "true");
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-matched-key", key);
|
expect(outputMock).toHaveBeenCalledWith("cache-matched-key", key);
|
||||||
|
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
|
||||||
|
|
||||||
expect(outputMock).toHaveBeenCalledTimes(3);
|
expect(outputMock).toHaveBeenCalledTimes(4);
|
||||||
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
|
expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
|
||||||
expect(failedMock).toHaveBeenCalledTimes(0);
|
expect(failedMock).toHaveBeenCalledTimes(0);
|
||||||
|
@ -212,8 +215,9 @@ test("restore with cache found for restore key", async () => {
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
expect(outputMock).toHaveBeenCalledWith("cache-primary-key", key);
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-hit", "false");
|
expect(outputMock).toHaveBeenCalledWith("cache-hit", "false");
|
||||||
expect(outputMock).toHaveBeenCalledWith("cache-matched-key", restoreKey);
|
expect(outputMock).toHaveBeenCalledWith("cache-matched-key", restoreKey);
|
||||||
|
expect(outputMock).toHaveBeenCalledWith("cache-path", path);
|
||||||
|
|
||||||
expect(outputMock).toHaveBeenCalledTimes(3);
|
expect(outputMock).toHaveBeenCalledTimes(4);
|
||||||
|
|
||||||
expect(infoMock).toHaveBeenCalledWith(
|
expect(infoMock).toHaveBeenCalledWith(
|
||||||
`Cache restored from key: ${restoreKey}`
|
`Cache restored from key: ${restoreKey}`
|
||||||
|
|
|
@ -59586,7 +59586,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
|
const isGitHubHost = hostname === "GITHUB.COM";
|
||||||
|
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||||
|
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||||
|
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isExactKeyMatch(key, cacheKey) {
|
function isExactKeyMatch(key, cacheKey) {
|
||||||
|
|
|
@ -59586,7 +59586,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
|
const isGitHubHost = hostname === "GITHUB.COM";
|
||||||
|
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||||
|
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||||
|
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isExactKeyMatch(key, cacheKey) {
|
function isExactKeyMatch(key, cacheKey) {
|
||||||
|
|
|
@ -59599,7 +59599,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
|
const isGitHubHost = hostname === "GITHUB.COM";
|
||||||
|
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||||
|
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||||
|
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isExactKeyMatch(key, cacheKey) {
|
function isExactKeyMatch(key, cacheKey) {
|
||||||
|
|
|
@ -59599,7 +59599,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
|
const isGitHubHost = hostname === "GITHUB.COM";
|
||||||
|
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||||
|
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||||
|
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
exports.isGhes = isGhes;
|
exports.isGhes = isGhes;
|
||||||
function isExactKeyMatch(key, cacheKey) {
|
function isExactKeyMatch(key, cacheKey) {
|
||||||
|
|
|
@ -3521,12 +3521,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/braces": {
|
"node_modules/braces": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fill-range": "^7.0.1"
|
"fill-range": "^7.1.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
|
@ -4622,9 +4622,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fill-range": {
|
"node_modules/fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
|
@ -12302,12 +12302,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"braces": {
|
"braces": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"fill-range": "^7.0.1"
|
"fill-range": "^7.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
|
@ -13127,9 +13127,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fill-range": {
|
"fill-range": {
|
||||||
"version": "7.0.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
|
|
|
@ -17,6 +17,7 @@ The restore action restores a cache. It works similarly to the `cache` action ex
|
||||||
* `cache-hit` - A boolean value to indicate an exact match was found for the key.
|
* `cache-hit` - A boolean value to indicate an exact match was found for the key.
|
||||||
* `cache-primary-key` - Cache primary key passed in the input to use in subsequent steps of the workflow.
|
* `cache-primary-key` - Cache primary key passed in the input to use in subsequent steps of the workflow.
|
||||||
* `cache-matched-key` - Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys.
|
* `cache-matched-key` - Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys.
|
||||||
|
* `cache-path` - The list of files, directories, and wildcard patterns passed in the input.
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
`cache-hit` will be set to `true` only when cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`.
|
`cache-hit` will be set to `true` only when cache hit occurs for the exact `key` match. For a partial key match via `restore-keys` or a cache miss, it will be set to `false`.
|
||||||
|
|
|
@ -30,6 +30,8 @@ outputs:
|
||||||
description: 'A resolved cache key for which cache match was attempted'
|
description: 'A resolved cache key for which cache match was attempted'
|
||||||
cache-matched-key:
|
cache-matched-key:
|
||||||
description: 'Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys'
|
description: 'Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys'
|
||||||
|
cache-path:
|
||||||
|
description: 'The list of files, directories, and wildcard patterns passed in the input'
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
main: '../dist/restore-only/index.js'
|
main: '../dist/restore-only/index.js'
|
||||||
|
|
|
@ -11,12 +11,14 @@ export enum Inputs {
|
||||||
export enum Outputs {
|
export enum Outputs {
|
||||||
CacheHit = "cache-hit", // Output from cache, restore action
|
CacheHit = "cache-hit", // Output from cache, restore action
|
||||||
CachePrimaryKey = "cache-primary-key", // Output from restore action
|
CachePrimaryKey = "cache-primary-key", // Output from restore action
|
||||||
CacheMatchedKey = "cache-matched-key" // Output from restore action
|
CacheMatchedKey = "cache-matched-key", // Output from restore action
|
||||||
|
CachePath = "cache-path" // Output from restore action
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum State {
|
export enum State {
|
||||||
CachePrimaryKey = "CACHE_KEY",
|
CachePrimaryKey = "CACHE_KEY",
|
||||||
CacheMatchedKey = "CACHE_RESULT"
|
CacheMatchedKey = "CACHE_RESULT",
|
||||||
|
CachePath = "CACHE_PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Events {
|
export enum Events {
|
||||||
|
|
|
@ -32,6 +32,8 @@ export async function restoreImpl(
|
||||||
const primaryKey = core.getInput(Inputs.Key, { required: true });
|
const primaryKey = core.getInput(Inputs.Key, { required: true });
|
||||||
stateProvider.setState(State.CachePrimaryKey, primaryKey);
|
stateProvider.setState(State.CachePrimaryKey, primaryKey);
|
||||||
|
|
||||||
|
stateProvider.setState(State.CachePath, core.getInput(Inputs.Path)); // Output path unchanged from input
|
||||||
|
|
||||||
const restoreKeys = utils.getInputAsArray(Inputs.RestoreKeys);
|
const restoreKeys = utils.getInputAsArray(Inputs.RestoreKeys);
|
||||||
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
const cachePaths = utils.getInputAsArray(Inputs.Path, {
|
||||||
required: true
|
required: true
|
||||||
|
|
|
@ -35,7 +35,8 @@ export class StateProvider extends StateProviderBase {
|
||||||
export class NullStateProvider extends StateProviderBase {
|
export class NullStateProvider extends StateProviderBase {
|
||||||
stateToOutputMap = new Map<string, string>([
|
stateToOutputMap = new Map<string, string>([
|
||||||
[State.CacheMatchedKey, Outputs.CacheMatchedKey],
|
[State.CacheMatchedKey, Outputs.CacheMatchedKey],
|
||||||
[State.CachePrimaryKey, Outputs.CachePrimaryKey]
|
[State.CachePrimaryKey, Outputs.CachePrimaryKey],
|
||||||
|
[State.CachePath, Outputs.CachePath]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
setState = (key: string, value: string) => {
|
setState = (key: string, value: string) => {
|
||||||
|
|
|
@ -7,7 +7,13 @@ export function isGhes(): boolean {
|
||||||
const ghUrl = new URL(
|
const ghUrl = new URL(
|
||||||
process.env["GITHUB_SERVER_URL"] || "https://github.com"
|
process.env["GITHUB_SERVER_URL"] || "https://github.com"
|
||||||
);
|
);
|
||||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
|
||||||
|
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||||
|
const isGitHubHost = hostname === "GITHUB.COM";
|
||||||
|
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||||
|
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||||
|
|
||||||
|
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
|
export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
|
||||||
|
|
Loading…
Reference in New Issue