Skip to content

Commit bcffb2b

Browse files
committed
Unify checks into a single job
1 parent 6f8805e commit bcffb2b

2 files changed

Lines changed: 29 additions & 82 deletions

File tree

.github/workflows/check-repo-size.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/pr-checks.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,24 @@ jobs:
6767
sarif_file: eslint.sarif
6868
category: eslint
6969

70-
# Verifying the PR checks are up-to-date requires Node 24. The PR checks are not dependent
71-
# on the main codebase and therefore do not need to be run as part of the same matrix that
72-
# we use for the `unit-tests` job.
73-
verify-pr-checks:
74-
name: Verify PR checks
70+
# These checks do not need to be run as part of the same matrix that we use for the `unit-tests`
71+
# job.
72+
pr-checks:
73+
name: PR checks
7574
if: github.triggering_actor != 'dependabot[bot]'
7675
permissions:
7776
contents: read
77+
pull-requests: write
7878
runs-on: ubuntu-slim
7979
timeout-minutes: 10
8080

8181
steps:
82-
- name: Prepare git (Windows)
83-
if: runner.os == 'Windows'
84-
run: git config --global core.autocrlf false
85-
8682
- name: Checkout repository
8783
uses: actions/checkout@v6
84+
with:
85+
# Need full history so we have both the PR merge commit (HEAD) and the base SHA locally
86+
# for `git archive` to work against either.
87+
fetch-depth: 0
8888

8989
- name: Set up Node.js
9090
uses: actions/setup-node@v6
@@ -96,29 +96,29 @@ jobs:
9696
run: npm ci
9797

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

102101
- name: Run pr-checks tests
103-
if: always()
104102
working-directory: pr-checks
105103
run: npx tsx --test
106104

107-
check-node-version:
108-
if: github.triggering_actor != 'dependabot[bot]'
109-
name: Check Action Node versions
110-
runs-on: ubuntu-latest
111-
timeout-minutes: 45
112-
env:
113-
BASE_REF: ${{ github.base_ref }}
114-
115-
permissions:
116-
contents: read
117-
118-
steps:
119-
- uses: actions/checkout@v6
120-
- id: head-version
121-
name: Verify all Actions use the same Node version
105+
- name: Check repo size
106+
if: >-
107+
github.event_name == 'pull_request' &&
108+
github.event.pull_request.head.repo.full_name == github.repository &&
109+
github.event.pull_request.user.login != 'dependabot[bot]'
110+
working-directory: pr-checks
111+
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
BASE_REF: ${{ github.event.pull_request.base.ref }}
114+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
115+
PR_NUMBER: ${{ github.event.pull_request.number }}
116+
GITHUB_REPOSITORY: ${{ github.repository }}
117+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
118+
run: npx tsx check-repo-size.ts
119+
120+
- name: Verify all Actions use the same Node version
121+
id: head-version
122122
run: |
123123
NODE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq)
124124
echo "NODE_VERSION: ${NODE_VERSION}"
@@ -128,12 +128,12 @@ jobs:
128128
fi
129129
echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT
130130
131-
- id: checkout-base
132-
name: 'Backport: Check out base ref'
131+
- name: 'Backport: Check out base ref'
132+
id: checkout-base
133133
if: ${{ startsWith(github.head_ref, 'backport-') }}
134134
uses: actions/checkout@v6
135135
with:
136-
ref: ${{ env.BASE_REF }}
136+
ref: ${{ github.base_ref }}
137137

138138
- name: 'Backport: Verify Node versions unchanged'
139139
if: steps.checkout-base.outcome == 'success'

0 commit comments

Comments
 (0)