Skip to content
31 changes: 30 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,22 @@ jobs:
if: "${{ !cancelled() && needs.classify_pr.outputs.skip_ci != 'true' }}"
runs-on: "${{ fromJSON(needs.classify_pr.outputs.ubuntu_runner || '[\"ubuntu-latest\"]') }}"
steps:
# On PRs github.ref is the merge ref (refs/pull/N/merge), so the required
# checks validate the merge result, not just the PR tip. GitHub builds that
# ref asynchronously and it can briefly 404 right after a push, so on
# failure we back off and retry the same ref once.
- name: 'Checkout'
id: 'checkout'
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
continue-on-error: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The continue-on-error: true on this checkout is a load-bearing part of the retry mechanism — without it, a checkout failure immediately fails the job and the retry step is never reached. There's no comment explaining this dependency, so a future maintainer could reasonably remove it as defensive clutter, silently killing the retry. A one-line comment prevents this.

Suggested change
continue-on-error: true
continue-on-error: true # required: lets the job reach the retry step below

(Same applies to the Test job's continue-on-error on line 233.)

— qwen3.7-max via Qwen Code /review

with:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
fetch-depth: 0
- name: 'Back off for the merge ref to build'
if: "${{ steps.checkout.outcome == 'failure' }}"
run: 'sleep 10'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The backoff step is run: 'sleep 10' with no diagnostic output. When the retry fires, there's no ::warning:: annotation in the Actions log, making it hard to track how often the retry triggers or to debug checkout failures at a glance.

Suggested change
run: 'sleep 10'
run: |-
echo "::warning::Initial checkout failed for ref ${{ github.ref }} (likely transient merge-ref lag). Retrying after 10s backoff."
sleep 10

— qwen3.7-max via Qwen Code /review

- name: 'Checkout (retry on transient ref lag)'
if: "${{ steps.checkout.outcome == 'failure' }}"
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
with:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Suggestion] The Lint job's initial checkout (line 120) specifies fetch-depth: 0, but this retry checkout (the pre-existing line repurposed as fallback) has no fetch-depth and defaults to 1. If the first checkout fails and the retry succeeds, the Lint job runs against a shallow clone — any lint step that depends on git history would see truncated results.

Suggested change
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
with:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
fetch-depth: 0

— qwen3.7-max via Qwen Code /review

Expand Down Expand Up @@ -211,9 +226,22 @@ jobs:
node-version: '22.x'
upload-coverage: 'false'
steps:
# See the Lint job's checkout: merge ref on PRs, back off and retry once on transient lag.
- name: 'Checkout'
id: 'checkout'
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' }}"
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
continue-on-error: true
with:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'
- name: 'Back off for the merge ref to build'
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' && steps.checkout.outcome == 'failure' }}"
run: 'sleep 10'
- name: 'Checkout (retry on transient ref lag)'
if: "${{ needs.classify_pr.outputs.skip_ci != 'true' && steps.checkout.outcome == 'failure' }}"
uses: 'actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd' # v6.0.2
with:
ref: '${{ github.event.inputs.branch_ref || github.ref }}'

# Self-hosted can't reach nodejs.org reliably; reuse the machine's Node.
- name: 'Set up Node.js ${{ matrix.node-version }} (hosted)'
Expand Down Expand Up @@ -288,9 +316,10 @@ jobs:
needs:
- 'classify_pr'
- 'test'
# !cancelled() not always(): don't let a cancelled run hold the concurrency slot here.
if: |-
${{
always() &&
!cancelled() &&
needs.classify_pr.outputs.skip_ci != 'true' &&
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
Expand Down
Loading