Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 39 additions & 29 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ jobs:
runs-on: ${{ matrix.os }}
timeout-minutes: 45

concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' || false }}
group: pr-checks-unit-tests-${{ github.ref }}-${{ github.event_name }}-${{ matrix.os }}-node${{ matrix['node-version'] }}

steps:
- name: Prepare git (Windows)
if: runner.os == 'Windows'
Expand Down Expand Up @@ -67,24 +71,28 @@ jobs:
sarif_file: eslint.sarif
category: eslint

# Verifying the PR checks are up-to-date requires Node 24. The PR checks are not dependent
# on the main codebase and therefore do not need to be run as part of the same matrix that
# we use for the `unit-tests` job.
verify-pr-checks:
name: Verify PR checks
# These checks do not need to be run as part of the same matrix that we use for the `unit-tests`
# job.
pr-checks:
name: PR Checks
Comment thread
mbg marked this conversation as resolved.
Outdated
if: github.triggering_actor != 'dependabot[bot]'
permissions:
contents: read
pull-requests: write
Comment thread
henrymercer marked this conversation as resolved.
Outdated
runs-on: ubuntu-slim
timeout-minutes: 10

steps:
- name: Prepare git (Windows)
if: runner.os == 'Windows'
run: git config --global core.autocrlf false
concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' || false }}
group: pr-checks-pr-checks-${{ github.ref }}-${{ github.event_name }}

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Need full history so we have both the PR merge commit (HEAD) and the base SHA locally
# for `git archive` to work against either.
fetch-depth: 0
Comment thread
henrymercer marked this conversation as resolved.
Outdated

- name: Set up Node.js
uses: actions/setup-node@v6
Expand All @@ -96,29 +104,31 @@ jobs:
run: npm ci

- name: Verify PR checks up to date
if: always()
run: .github/workflows/script/verify-pr-checks.sh

- name: Run pr-checks tests
if: always()
Comment thread
mbg marked this conversation as resolved.
working-directory: pr-checks
run: npx tsx --test

check-node-version:
if: github.triggering_actor != 'dependabot[bot]'
name: Check Action Node versions
runs-on: ubuntu-latest
timeout-minutes: 45
env:
BASE_REF: ${{ github.base_ref }}

permissions:
contents: read

steps:
- uses: actions/checkout@v6
- id: head-version
name: Verify all Actions use the same Node version
- name: Check repo size
# Forks and Dependabot PRs don't have permission to write comments, so skip the check in
# those cases.
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]'
Comment thread
mbg marked this conversation as resolved.
Outdated
working-directory: pr-checks
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: npx tsx check-repo-size.ts

- name: Verify all Actions use the same Node version
id: head-version
run: |
NODE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq)
Comment thread
henrymercer marked this conversation as resolved.
Outdated
Comment thread
henrymercer marked this conversation as resolved.
Outdated
echo "NODE_VERSION: ${NODE_VERSION}"
Expand All @@ -128,12 +138,12 @@ jobs:
fi
echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT

- id: checkout-base
name: 'Backport: Check out base ref'
- name: 'Backport: Check out base ref'
id: checkout-base
if: ${{ startsWith(github.head_ref, 'backport-') }}
uses: actions/checkout@v6
with:
ref: ${{ env.BASE_REF }}
ref: ${{ github.base_ref }}

- name: 'Backport: Verify Node versions unchanged'
if: steps.checkout-base.outcome == 'success'
Expand Down
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading