mirror of
https://github.com/actions/cache.git
synced 2025-03-14 04:07:00 +00:00
Merge branch 'actions:main' into patch-1
This commit is contained in:
commit
f238c072d2
10 changed files with 473 additions and 410 deletions
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/
|
8
.github/workflows/licensed.yml
vendored
8
.github/workflows/licensed.yml
vendored
|
@ -1,8 +1,12 @@
|
||||||
name: Licensed
|
name: Licensed
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push: {branches: main}
|
push:
|
||||||
pull_request: {branches: main}
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|
|
@ -68,7 +68,7 @@ test("restore on GHES should no-op", async () => {
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
|
||||||
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
|
expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
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(saveCacheMock).toHaveBeenCalledTimes(0);
|
||||||
expect(logWarningMock).toHaveBeenCalledWith(
|
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"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
2
dist/restore/index.js
vendored
2
dist/restore/index.js
vendored
|
@ -49218,7 +49218,7 @@ function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
if (utils.isGhes()) {
|
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);
|
utils.setCacheHitOutput(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
2
dist/save/index.js
vendored
2
dist/save/index.js
vendored
|
@ -47162,7 +47162,7 @@ function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
if (utils.isGhes()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (!utils.isValidEvent()) {
|
if (!utils.isValidEvent()) {
|
||||||
|
|
11
examples.md
11
examples.md
|
@ -451,12 +451,17 @@ jobs:
|
||||||
## Python - pipenv
|
## Python - pipenv
|
||||||
|
|
||||||
```yaml
|
```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
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.local/share/virtualenvs
|
path: ~/.local/share/virtualenvs
|
||||||
key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }}
|
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pipenv-
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## R - renv
|
## R - renv
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -6473,9 +6473,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "5.2.2",
|
"version": "5.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz",
|
||||||
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
|
"integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"async-limiter": "~1.0.0"
|
"async-limiter": "~1.0.0"
|
||||||
|
|
|
@ -7,7 +7,9 @@ import * as utils from "./utils/actionUtils";
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (utils.isGhes()) {
|
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);
|
utils.setCacheHitOutput(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,9 @@ process.on("uncaughtException", e => utils.logWarning(e.message));
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (utils.isGhes()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue