From bf64dda1b97e964f9719a6217572a96af15a58eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dean=20Qui=C3=B1anola?= Date: Fri, 30 Oct 2026 15:08:00 -0700 Subject: [PATCH 1/2] ci: open release PRs with the app token again Since #401 the built-in token handles both tagging and release PRs. GitHub does not start pull_request workflows for events made with the built-in token, so the next release PR would never get the required Validation check, and ci.yml's Guard expects runpod-release-please-bot as the author. Run release-please twice: the built-in token tags and creates releases (skip-github-pull-request), then the app token opens or updates the release PR (skip-github-release). The app does not need the workflows permission for PRs. --- .github/workflows/release-please.yml | 31 +++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index d38379cf..decba84a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -27,15 +27,36 @@ jobs: tag_name: ${{ steps.release.outputs.tag_name }} steps: - - name: Run Release Please + # Releases and release PRs use different tokens. + # + # Tagging: the built-in token. The release app lacks the workflows + # permission, and GitHub requires it to tag a commit whose history + # changes .github/workflows/ unless a branch already points at it. + # Run this step first so a merged release PR is tagged before the + # PR step looks for it. + - name: Create release uses: google-github-actions/release-please-action@v4 id: release with: - # The built-in token, as runpod-python uses. The release app lacks the - # workflows permission #399 requested, so its token can't be created. - # The workflow-level permissions grant contents, pull-requests and - # issues write. token: ${{ secrets.GITHUB_TOKEN }} + skip-github-pull-request: true + + # Release PRs: the app token. GitHub does not start pull_request + # workflows for events made with the built-in token, so a release PR + # opened with it never gets the required Validation check. ci.yml's + # Guard also expects runpod-release-please-bot as the author. + - name: Generate GitHub App Token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + + - name: Open or update release PR + uses: google-github-actions/release-please-action@v4 + with: + token: ${{ steps.app-token.outputs.token }} + skip-github-release: true pypi-publish: name: PyPI Publish From 96f524cf5cd610a09fc9629d91eec5a13cb09bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dean=20Qui=C3=B1anola?= Date: Fri, 30 Oct 2026 15:28:31 -0700 Subject: [PATCH 2/2] ci: probe the release PR and tag paths (do not merge) --- .github/workflows/release-flow-probe.yml | 86 ++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/release-flow-probe.yml diff --git a/.github/workflows/release-flow-probe.yml b/.github/workflows/release-flow-probe.yml new file mode 100644 index 00000000..6a7f5e7f --- /dev/null +++ b/.github/workflows/release-flow-probe.yml @@ -0,0 +1,86 @@ +name: release-flow-probe + +on: pull_request + +permissions: + contents: write + checks: read + pull-requests: read + +jobs: + # Step 1 of release-please.yml: can the built-in token tag the commit main + # points at, with workflow changes since v1.21.1 in its history? + tag-probe: + runs-on: blacksmith-2vcpu-ubuntu-2404 + steps: + - env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + R: ${{ github.repository }} + run: | + set -uo pipefail + sha=$(gh api "repos/$R/commits/main" --jq .sha) + echo "main=$sha" + echo "workflow changes since v1.21.1:" + gh api "repos/$R/compare/v1.21.1...$sha" --jq '.files[].filename' | grep '^.github/workflows/' || echo none + tag="probe-tag-$GITHUB_RUN_ID" + out=$(gh api -i -X POST "repos/$R/git/refs" -f ref="refs/tags/$tag" -f sha="$sha" 2>&1) + echo "$out" | grep -iE '^HTTP/|x-accepted-github-permissions|"message"' + gh api -X DELETE "repos/$R/git/refs/tags/$tag" >/dev/null 2>&1 && echo "deleted $tag" + echo "$out" | grep -q '^HTTP/2.0 201' || { echo "TAG PROBE FAILED"; exit 1; } + + # Step 2 of release-please.yml: a PR opened with the app token on a + # release-please-- branch must start ci.yml and pass Validation. + pr-probe: + runs-on: blacksmith-2vcpu-ubuntu-2404 + steps: + - name: Generate GitHub App Token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + + - name: Open release-shaped PR as the app + id: open + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + R: ${{ github.repository }} + run: | + set -euo pipefail + branch="release-please--probe-$GITHUB_RUN_ID" + sha=$(gh api "repos/$R/commits/main" --jq .sha) + gh api -X POST "repos/$R/git/refs" -f ref="refs/heads/$branch" -f sha="$sha" --jq .ref + blob=$(gh api "repos/$R/contents/CHANGELOG.md?ref=$branch" --jq .sha) + content=$( { echo ""; gh api "repos/$R/contents/CHANGELOG.md?ref=$branch" --jq .content | base64 -d; } | base64 -w0) + gh api -X PUT "repos/$R/contents/CHANGELOG.md" -f message="chore: release flow probe" -f content="$content" -f sha="$blob" -f branch="$branch" --jq .commit.sha + num=$(gh api -X POST "repos/$R/pulls" -f title="probe: release PR CI trigger (do not merge)" -f head="$branch" -f base=main -f body="Temporary probe for #405. Closed automatically." --jq .number) + echo "opened PR #$num as $(gh api repos/$R/pulls/$num --jq .user.login)" + echo "branch=$branch" >> "$GITHUB_OUTPUT" + echo "num=$num" >> "$GITHUB_OUTPUT" + + - name: Wait for Guard and Validation on that PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + R: ${{ github.repository }} + NUM: ${{ steps.open.outputs.num }} + run: | + set -uo pipefail + head=$(gh api "repos/$R/pulls/$NUM" --jq .head.sha) + for i in $(seq 1 40); do + runs=$(gh api "repos/$R/commits/$head/check-runs" --jq '.check_runs[] | "\(.name)=\(.status)/\(.conclusion)"' | sort) + echo "[$i] $(echo $runs)" + if echo "$runs" | grep -q '^Validation=completed/success'; then echo "VALIDATION PASSED"; exit 0; fi + if echo "$runs" | grep -q '^Validation=completed/'; then echo "VALIDATION DID NOT PASS"; exit 1; fi + sleep 15 + done + echo "TIMED OUT: Validation never completed" + exit 1 + + - name: Close probe PR and delete branch + if: always() && steps.open.outputs.num != '' + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + R: ${{ github.repository }} + run: | + gh api -X PATCH "repos/$R/pulls/${{ steps.open.outputs.num }}" -f state=closed --jq .state + gh api -X DELETE "repos/$R/git/refs/heads/${{ steps.open.outputs.branch }}" && echo "deleted branch"