Skip to content

Commit 590ada3

Browse files
committed
tools: do not use the set-output command in workflows
The `set-output` command is deprecated. Use the `GITHUB_ENV` environment file. Refs: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
1 parent 962b9ab commit 590ada3

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

.github/workflows/auto-start-ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,25 @@ jobs:
2222
pull-requests: read
2323
if: github.repository == 'nodejs/node'
2424
runs-on: ubuntu-latest
25-
outputs:
26-
numbers: ${{ steps.get_prs_for_ci.outputs.numbers }}
2725
steps:
2826
- name: Get Pull Requests
2927
id: get_prs_for_ci
3028
run: >
31-
gh pr list \
29+
numbers=$(gh pr list \
3230
--repo ${{ github.repository }} \
3331
--label 'request-ci' \
3432
--json 'number' \
35-
-t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \
36-
--limit 100
33+
-t '{{ range . }}{{ .number }} {{ end }}' \
34+
--limit 100)
35+
echo "numbers=$numbers" >> $GITHUB_ENV
3736
env:
3837
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3938
start-ci:
4039
permissions:
4140
contents: read
4241
pull-requests: write
4342
needs: get-prs-for-ci
44-
if: needs.get-prs-for-ci.outputs.numbers != ''
43+
if: env.numbers != ''
4544
runs-on: ubuntu-latest
4645
steps:
4746
- uses: actions/checkout@v3
@@ -65,6 +64,6 @@ jobs:
6564
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)"
6665
6766
- name: Start the CI
68-
run: ./tools/actions/start-ci.sh ${{ needs.get-prs-for-ci.outputs.numbers }}
67+
run: ./tools/actions/start-ci.sh ${{ env.numbers }}
6968
env:
7069
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/commit-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ jobs:
1515
- name: Compute number of commits in the PR
1616
id: nb-of-commits
1717
run: |
18-
echo "::set-output name=plusOne::$((${{ github.event.pull_request.commits }} + 1))"
19-
echo "::set-output name=minusOne::$((${{ github.event.pull_request.commits }} - 1))"
18+
echo "plusOne=$((${{ github.event.pull_request.commits }} + 1))" >> $GITHUB_ENV
19+
echo "minusOne=$((${{ github.event.pull_request.commits }} - 1))" >> $GITHUB_ENV
2020
- uses: actions/checkout@v3
2121
with:
22-
fetch-depth: ${{ steps.nb-of-commits.outputs.plusOne }}
22+
fetch-depth: ${{ env.plusOne }}
2323
persist-credentials: false
2424
- run: git reset HEAD^2
2525
- name: Install Node.js
@@ -29,4 +29,4 @@ jobs:
2929
- name: Validate commit message
3030
run: |
3131
echo "::add-matcher::.github/workflows/commit-lint-problem-matcher.json"
32-
git rev-parse HEAD~${{ steps.nb-of-commits.outputs.minusOne }} | xargs npx -q core-validate-commit --no-validate-metadata --tap
32+
git rev-parse HEAD~${{ env.minusOne }} | xargs npx -q core-validate-commit --no-validate-metadata --tap

.github/workflows/commit-queue.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,23 @@ jobs:
2727
pull-requests: read
2828
if: github.repository == 'nodejs/node'
2929
runs-on: ubuntu-latest
30-
outputs:
31-
numbers: ${{ steps.get_mergeable_prs.outputs.numbers }}
3230
steps:
3331
- name: Get Pull Requests
3432
id: get_mergeable_prs
3533
run: >
36-
gh pr list \
34+
numbers=$(gh pr list \
3735
--repo ${{ github.repository }} \
3836
--base ${{ github.ref_name }} \
3937
--label 'commit-queue' \
4038
--json 'number' \
41-
-t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \
42-
--limit 100
39+
-t '{{ range . }}{{ .number }} {{ end }}' \
40+
--limit 100)
41+
echo "numbers=$numbers" >> $GITHUB_ENV
4342
env:
4443
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4544
commitQueue:
4645
needs: get_mergeable_prs
47-
if: needs.get_mergeable_prs.outputs.numbers != ''
46+
if: env.numbers != ''
4847
runs-on: ubuntu-latest
4948
steps:
5049
- uses: actions/checkout@v3
@@ -82,6 +81,6 @@ jobs:
8281
ncu-config set owner "${OWNER}"
8382
8483
- name: Start the Commit Queue
85-
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ needs.get_mergeable_prs.outputs.numbers }}
84+
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ env.numbers }}
8685
env:
8786
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}

.github/workflows/label-flaky-test-issue.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
labels="${labels}${platform2label[$platform]},"; \
4242
done;
4343
44-
echo "::set-output name=LABELS::${labels::-1}"
44+
echo "LABELS=${labels::-1}" >> $GITHUB_ENV
4545
4646
- name: Add labels
4747
env:
4848
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4949
NUMBER: ${{ github.event.issue.number }}
50-
run: gh issue edit "$NUMBER" --repo ${{ github.repository }} --add-label "${{ steps.extract-labels.outputs.LABELS }}"
50+
run: gh issue edit "$NUMBER" --repo ${{ github.repository }} --add-label "${{ env.LABELS }}"

0 commit comments

Comments
 (0)