From 2a8cdb20c08135080614016d6df293c2605e6fa7 Mon Sep 17 00:00:00 2001 From: Claudio Wunder Date: Fri, 6 Nov 2026 18:20:45 +0100 Subject: [PATCH] meta: build docs for PRs whose base has no main run prepare downloads the nodejs/node SHA that the latest `main` run of generate.yml used for the PR's base commit. A PR stacked on another PR's branch has a base commit no such run built, so the download failed and generate never ran. Without a base run, prepare now skips the download and builds from the latest SHA of nodejs/node, as a push to main does. generate already skips the comparison when there's no base run, so these PRs still build every target, without a comparison. Assisted-by: Claude Opus 5.5 --- .github/workflows/generate.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index fd792043f..7588c49e5 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -57,17 +57,24 @@ jobs: echo "run_id=$ID" >> $GITHUB_OUTPUT - name: Download metadata artifact - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' && steps.main.outputs.run_id }} uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: commit run-id: ${{ steps.main.outputs.run_id }} github-token: ${{ secrets.GITHUB_TOKEN }} + # A PR whose base has no `main` run, such as one stacked on another PR's + # branch, has nothing to compare against: it builds from the latest SHA + # from nodejs/node, and `generate` skips the comparison - id: pr if: ${{ github.event_name == 'pull_request' }} run: | - SHA=$(cat commit) + if [ -f commit ]; then + SHA=$(cat commit) + else + SHA=$(git ls-remote https://github.com/nodejs/node.git HEAD | awk '{print $1}') + fi echo "sha=$SHA" >> "$GITHUB_OUTPUT" generate: