Skip to content

Commit

Permalink
actions: Use node20 runner (#35262)
Browse files Browse the repository at this point in the history
GitHub has deprecated the node16 runner in favor of node20.
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

Thus, we need to make some updates:
* Update our actions to use the node20 runner.
* Update workflows to use new versions of various actions:
  - actions/cache v3 → v4
  - actions/setup-node v3 → v4
  - actions/github-script v6 → v7
  - actions/setup-node v3 → v4
  - actions/stale v8 → v9
  - github/codeql-action v2 → v3
  - peter-evans/repository-dispatch v2 → v3
* Update references to the above in some docs.
* Remove a long-commented-out job in gardening.yml
  • Loading branch information
anomiex authored Jan 26, 2024
1 parent 2f48ff6 commit ccb390e
Show file tree
Hide file tree
Showing 38 changed files with 100 additions and 101 deletions.
4 changes: 2 additions & 2 deletions .github/actions/tool-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ runs:
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Use composer cache
if: steps.versions.outputs.php-version != 'false'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -94,7 +94,7 @@ runs:
version: ${{ steps.versions.outputs.pnpm-version }}
- name: Setup Node
if: steps.versions.outputs.node-version != 'false'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
# Prefix the version with a caret as otherwise actions/setup-node will waste API calls finding where to download the exact version.
node-version: ^${{ steps.versions.outputs.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/tool-setup/post-run-action/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Post-run proxy log dump
description: Cat the proxy log as a post-run step
runs:
using: node16
using: node20
main: main.mjs
post: post.mjs
2 changes: 1 addition & 1 deletion .github/actions/turnstile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build
run: npm build
Expand Down
2 changes: 1 addition & 1 deletion .github/files/gh-autorelease/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Create release
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/files/gh-autotagger/workflows/autotagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
exit 1
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# We want to potentially trigger "tag" events, but the default GITHUB_TOKEN
# explicitly does not trigger events.
Expand Down
2 changes: 1 addition & 1 deletion .github/files/gh-e2e/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Create a repository dispatch
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_DISPATCH_TOKEN }}
repository: automattic/jetpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
exit 1
fi
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
# NPM version shouldn't matter, just use the LTS.
node-version: 'lts/*'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fi
exit $EXIT
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/autotagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Fetch tags, shallowly and blobless
run: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/block-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 90 # 2023-04-18: Some runs exceeded 50 minutes
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'WordPress/gutenberg'
path: 'gutenberg'
Expand All @@ -32,7 +32,7 @@ jobs:
npx playwright install chromium --with-deps
npm run build:packages
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('gutenberg/**/package-lock.json') }}
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:

steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.E2E_TEST_REPORTS_TOKEN }}
repository: automattic/jetpack-e2e-reports
Expand All @@ -110,7 +110,7 @@ jobs:
needs: [block-performance]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up tools
uses: ./.github/actions/tool-setup
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
timeout-minutes: 60 # 2021-10-26: Build for arm64 is S-L-O-W. Sigh.

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up qemu
uses: docker/setup-qemu-action@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
changed_projects: ${{ steps.changed.outputs.projects }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# For pull requests, list-changed-projects.sh needs the merge base.
# But it doesn't have to be checked out.
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Check if a WordPress.com test reminder comment is needed.
id: check-test-reminder-comment
uses: actions/github-script@v6
uses: actions/github-script@v7
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
env:
CHANGED: ${{ steps.changed.outputs.projects }}
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:

- name: Update reminder with testing instructions
id: update-reminder-comment
uses: actions/github-script@v6
uses: actions/github-script@v7
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && fromJSON(steps.check-test-reminder-comment.outputs.result)['commentId'] != 0 }}
env:
BRANCH_NAME: ${{ github.head_ref }}
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
if: needs.build.outputs.any_plugins == 'true'
timeout-minutes: 10 # 2021-06-24: Successful runs should take just a few seconds now. But sometimes the upload is slow.
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: monorepo

Expand Down Expand Up @@ -293,7 +293,7 @@ jobs:

# Not setting a job-level timeout because it would be kind of pointless with the blocking step. Set a step timeout for all other steps instead.
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: monorepo
timeout-minutes: 1 # 2021-01-18: Successful runs seem to take a few seconds
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/delete-mirror-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
timeout-minutes: 5 # 2022-11-21: Shouldn't take long.
if: github.event_name == 'delete' && github.repository == 'Automattic/jetpack' && github.event.ref == 'prerelease'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: trunk
- name: Delete branches
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix: ${{ steps.evaluate.outputs.matrix }}
build-matrix: ${{ steps.evaluate.outputs.build-matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# For pull requests, list-changed-projects.sh needs the merge base.
- name: Deepen to merge base
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
steps:
- name: Ensure ${{ matrix.buildGroup }} build cache
id: jetpack-build-cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
lookup-only: true
path: |
Expand All @@ -88,7 +88,7 @@ jobs:

- name: Checkout code
if: steps.jetpack-build-cache.outputs.cache-hit != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup tools
if: steps.jetpack-build-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- name: Save ${{ matrix.buildGroup }} build cache
if: steps.jetpack-build-cache.outputs.cache-hit != 'true'
id: jetpack-build-cache-save
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
.
Expand All @@ -150,12 +150,12 @@ jobs:
matrix:
include: ${{ fromJson( needs.create-test-matrix.outputs.matrix ) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Restore ${{ matrix.buildGroup }} build cache
id: jetpack-build-cache
if: needs.build-projects.result == 'success' && ! startsWith( matrix.suite, 'atomic' )
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
.
Expand All @@ -172,14 +172,14 @@ jobs:
- name: Checkout jetpack-production
if: github.event_name == 'repository_dispatch' && github.event.client_payload.repository != 'Automattic/jetpack-production'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: Automattic/jetpack-production
path: build-output/build/Automattic/jetpack-production

- name: Checkout mirror repo
if: github.event_name == 'repository_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.event.client_payload.repository }}
ref: ${{ github.event.client_payload.ref_name }}
Expand Down Expand Up @@ -325,7 +325,7 @@ jobs:
echo "CLIENT_PAYLOAD=$( jq -nrc --arg repository "$REPOSITORY" --arg branch "$BRANCH" --arg pr_title "$PR_TITLE" --arg pr_number "$PR_NUMBER" --arg run_id "$GITHUB_RUN_ID" '{ repository: $repository, branch: $branch, pr_title: $pr_title, pr_number: $pr_number, run_id: $run_id }' )" >> "$GITHUB_OUTPUT"
- name: Trigger test report workflow
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.E2E_TEST_REPORTS_TOKEN }}
repository: automattic/jetpack-e2e-reports
Expand All @@ -339,7 +339,7 @@ jobs:
needs: [e2e-tests]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up tools
uses: ./.github/actions/tool-setup
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/gardening.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,14 @@ concurrency:
cancel-in-progress: true

jobs:
# review-crew-afk:
# name: "Review check"
# runs-on: ubuntu-latest
# if: github.event_name == 'pull_request_target' && github.event.action == 'labeled' && github.event.label.name == '[Status] Needs Review'
# timeout-minutes: 1 # 2021-01-18: Successful runs probably take a few seconds
# steps:
# - name: Comment
# uses: actions/[email protected]
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# script: |
# github.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Howdy! The Jetpack team has disappeared for a few days to a secret island lair to concoct new ways to make Jetpack one hundred billion percent better. As a result, your Pull Request may not be reviewed right away. Do not worry, we will be back next week to look at your work! Thank you for your understanding.'
# })
repo-gardening:
name: "Manage labels and assignees"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
timeout-minutes: 10 # 2021-03-12: Successful runs seem to take a few seconds, but can sometimes take a lot longer since we wait for previous runs to complete.
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup tools
uses: ./.github/actions/tool-setup
Expand All @@ -56,7 +39,7 @@ jobs:

- name: Checkout the PR
if: github.event_name == 'pull_request_target' && github.event.pull_request.state != 'closed'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
Expand Down
Loading

0 comments on commit ccb390e

Please sign in to comment.