Skip to content

Commit 673874e

Browse files
committed
Replace set-output with files to fix actions deprecation
1 parent 948d67b commit 673874e

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

.github/workflows/tests.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ jobs:
1515
uses: ./
1616
id: run-docker
1717
with:
18-
image: docker:20.10.3
18+
image: docker:29.0.4
19+
options: -v ${{ github.workspace }}:/github/workspace
1920
run: |
20-
echo "::set-output name=docker-version::`echo $DOCKER_VERSION`"
21+
# write into the mounted repo so the runner can read it
22+
echo "$DOCKER_VERSION" > /github/workspace/docker_version
2123
- name: Test the output
2224
uses: actions/github-script@v3
2325
with:
2426
script: |
25-
const dockerVersion = '${{ steps.run-docker.outputs.docker-version }}';
26-
if (dockerVersion !== '20.10.3') {
27-
core.setFailed(`Smoke Test Failed`);
27+
const fs = require('fs');
28+
const dockerVersion = fs.readFileSync('docker_version', 'utf8').trim();
29+
const expected = '29.0.4';
30+
if (dockerVersion !== expected) {
31+
core.setFailed(`Smoke Test Failed: expected ${expected} but received ${dockerVersion}`);
2832
}
2933
volume-mount-test:
3034
runs-on: ubuntu-latest
@@ -39,12 +43,13 @@ jobs:
3943
image: docker
4044
options: -v ${{ github.workspace }}:/work
4145
run: |
42-
echo "::set-output name=file-contents::`cat /work/someFile`"
46+
cp /work/someFile /work/secondFile
4347
- name: Check if file contents match
4448
uses: actions/github-script@v8
4549
with:
4650
script: |
47-
const fileContents = '${{ steps.run-docker.outputs.file-contents }}';
51+
const fs = require('fs');
52+
const fileContents = fs.readFileSync('secondFile', 'utf8').trim();
4853
if (fileContents !== 'some text') {
4954
core.setFailed(`Unable to mount workspace volume`);
5055
}

0 commit comments

Comments
 (0)