Skip to content

Commit d43ba9d

Browse files
committed
Skip prerelease reference PR during a first-stable release window
When a first stable release ships (X.Y.0), quarto-cli immediately publishes the next prerelease, X.(Y+1).0, but main's _quarto.yml keeps naming the previous minor until the prerelease -> main release merge. On 2026-11-02 main still said 1.10 while v1.12.0 existed. Opening or refreshing the rolling "Update reference pages (prerelease)" PR in that window regenerates reference pages for the next cycle on top of a prerelease branch that is about to become stable docs, which the release merge then has to untangle. A new release-window job reads main's _quarto.yml version and compares it with the incoming prerelease version. If the prerelease is more than one minor ahead (same major), the update job is skipped and a notice explains why. Otherwise behaviour is unchanged. Gating at job level also keeps the legacy-PR cleanup and stale-branch deletion from running in the window. Unparseable versions fail the run instead of silently skipping the check. Write permissions move from workflow level to the update job: with two jobs, zizmor flags workflow-level write grants, and the read-only check job does not need them.
1 parent e568edd commit d43ba9d

1 file changed

Lines changed: 56 additions & 3 deletions

File tree

‎.github/workflows/update-prerelease-reference.yml‎

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,70 @@ on:
1717
ISSUE_COMMENT_TRIGGER_PAT:
1818
required: true
1919

20-
permissions:
21-
contents: write # so it can push the rolling branch
22-
pull-requests: write # so it can open and comment on the PR
20+
permissions: {}
2321

2422
concurrency:
2523
group: prerelease-reference-update
2624
cancel-in-progress: false
2725

2826
jobs:
27+
# Between a first stable release (X.Y.0) and the prerelease -> main release
28+
# merge, main's _quarto.yml still names the previous minor while the
29+
# prerelease is already X.(Y+1). Reference updates against the prerelease
30+
# branch would then land on top of the pending release merge, so skip them.
31+
release-window:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
35+
outputs:
36+
in_window: ${{ steps.decide.outputs.in_window }}
37+
steps:
38+
- name: Read main's documented version
39+
id: main-version
40+
env:
41+
GH_TOKEN: ${{ github.token }}
42+
REPO: ${{ github.repository }}
43+
run: |
44+
main_version=$(gh api -H "Accept: application/vnd.github.raw" \
45+
"repos/$REPO/contents/_quarto.yml?ref=main" \
46+
| sed -n "s/^version: *['\"]\{0,1\}\([0-9][0-9.]*\)['\"]\{0,1\} *$/\1/p")
47+
echo "main_version=$main_version" >> "$GITHUB_OUTPUT"
48+
49+
- name: Decide whether a release window is open
50+
id: decide
51+
env:
52+
PRERELEASE_VERSION: ${{ inputs.version }}
53+
MAIN_VERSION: ${{ steps.main-version.outputs.main_version }}
54+
run: |
55+
if ! [[ "$PRERELEASE_VERSION" =~ ^v?([0-9]+)\.([0-9]+)(\.[0-9]+)?$ ]]; then
56+
echo "::error::Prerelease version \"$PRERELEASE_VERSION\" is not a valid X.Y.Z version"
57+
exit 1
58+
fi
59+
pre_major=${BASH_REMATCH[1]}
60+
pre_minor=${BASH_REMATCH[2]}
61+
62+
if ! [[ "$MAIN_VERSION" =~ ^([0-9]+)\.([0-9]+) ]]; then
63+
echo "::error::main _quarto.yml version \"$MAIN_VERSION\" is not a valid X.Y version"
64+
exit 1
65+
fi
66+
main_major=${BASH_REMATCH[1]}
67+
main_minor=${BASH_REMATCH[2]}
68+
69+
if [ "$pre_major" -eq "$main_major" ] && [ $((pre_minor - main_minor)) -gt 1 ]; then
70+
echo "in_window=true" >> "$GITHUB_OUTPUT"
71+
echo "::notice::Skipping reference update: prerelease v$PRERELEASE_VERSION is more than one minor ahead of main ($MAIN_VERSION), so a stable release is awaiting its release merge. Updates resume once main's _quarto.yml version is bumped."
72+
else
73+
echo "in_window=false" >> "$GITHUB_OUTPUT"
74+
echo "Prerelease v$PRERELEASE_VERSION vs main $MAIN_VERSION: no release window, proceeding."
75+
fi
76+
2977
update-reference:
78+
needs: release-window
79+
if: needs.release-window.outputs.in_window != 'true'
3080
runs-on: ubuntu-latest
81+
permissions:
82+
contents: write # so it can push the rolling branch
83+
pull-requests: write # so it can open and comment on the PR
3184
steps:
3285
- name: Checkout prerelease branch
3386
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

0 commit comments

Comments
 (0)