Skip to content

Commit

Permalink
tools: do not use the set-output command in workflows
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
lpinca committed Oct 16, 2022
1 parent 962b9ab commit 590ada3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/auto-start-ci.yml
Expand Up @@ -22,26 +22,25 @@ jobs:
pull-requests: read
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
outputs:
numbers: ${{ steps.get_prs_for_ci.outputs.numbers }}
steps:
- name: Get Pull Requests
id: get_prs_for_ci
run: >
gh pr list \
numbers=$(gh pr list \
--repo ${{ github.repository }} \
--label 'request-ci' \
--json 'number' \
-t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \
--limit 100
-t '{{ range . }}{{ .number }} {{ end }}' \
--limit 100)
echo "numbers=$numbers" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
start-ci:
permissions:
contents: read
pull-requests: write
needs: get-prs-for-ci
if: needs.get-prs-for-ci.outputs.numbers != ''
if: env.numbers != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -65,6 +64,6 @@ jobs:
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)"
- name: Start the CI
run: ./tools/actions/start-ci.sh ${{ needs.get-prs-for-ci.outputs.numbers }}
run: ./tools/actions/start-ci.sh ${{ env.numbers }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/commit-lint.yml
Expand Up @@ -15,11 +15,11 @@ jobs:
- name: Compute number of commits in the PR
id: nb-of-commits
run: |
echo "::set-output name=plusOne::$((${{ github.event.pull_request.commits }} + 1))"
echo "::set-output name=minusOne::$((${{ github.event.pull_request.commits }} - 1))"
echo "plusOne=$((${{ github.event.pull_request.commits }} + 1))" >> $GITHUB_ENV
echo "minusOne=$((${{ github.event.pull_request.commits }} - 1))" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
fetch-depth: ${{ steps.nb-of-commits.outputs.plusOne }}
fetch-depth: ${{ env.plusOne }}
persist-credentials: false
- run: git reset HEAD^2
- name: Install Node.js
Expand All @@ -29,4 +29,4 @@ jobs:
- name: Validate commit message
run: |
echo "::add-matcher::.github/workflows/commit-lint-problem-matcher.json"
git rev-parse HEAD~${{ steps.nb-of-commits.outputs.minusOne }} | xargs npx -q core-validate-commit --no-validate-metadata --tap
git rev-parse HEAD~${{ env.minusOne }} | xargs npx -q core-validate-commit --no-validate-metadata --tap
13 changes: 6 additions & 7 deletions .github/workflows/commit-queue.yml
Expand Up @@ -27,24 +27,23 @@ jobs:
pull-requests: read
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
outputs:
numbers: ${{ steps.get_mergeable_prs.outputs.numbers }}
steps:
- name: Get Pull Requests
id: get_mergeable_prs
run: >
gh pr list \
numbers=$(gh pr list \
--repo ${{ github.repository }} \
--base ${{ github.ref_name }} \
--label 'commit-queue' \
--json 'number' \
-t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \
--limit 100
-t '{{ range . }}{{ .number }} {{ end }}' \
--limit 100)
echo "numbers=$numbers" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
commitQueue:
needs: get_mergeable_prs
if: needs.get_mergeable_prs.outputs.numbers != ''
if: env.numbers != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -82,6 +81,6 @@ jobs:
ncu-config set owner "${OWNER}"
- name: Start the Commit Queue
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ needs.get_mergeable_prs.outputs.numbers }}
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ env.numbers }}
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/label-flaky-test-issue.yml
Expand Up @@ -41,10 +41,10 @@ jobs:
labels="${labels}${platform2label[$platform]},"; \
done;
echo "::set-output name=LABELS::${labels::-1}"
echo "LABELS=${labels::-1}" >> $GITHUB_ENV
- name: Add labels
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
run: gh issue edit "$NUMBER" --repo ${{ github.repository }} --add-label "${{ steps.extract-labels.outputs.LABELS }}"
run: gh issue edit "$NUMBER" --repo ${{ github.repository }} --add-label "${{ env.LABELS }}"

0 comments on commit 590ada3

Please sign in to comment.