From fa0cd426220b83f48a068cc696ffa0bafdf6dfce Mon Sep 17 00:00:00 2001 From: Ashhar Hasan Date: Fri, 2 Oct 2026 22:08:36 +0530 Subject: [PATCH] Use GitHub App token in Python versions update workflow GITHUB_TOKEN cannot push changes under .github/workflows/, so every run failed when the script updated the CI matrix. PRs opened with GITHUB_TOKEN also do not trigger CI. The workflow now uses the service account GitHub App token, the same way trinodb/trino does. It also skips running on forks. --- .github/workflows/update-python-versions.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-python-versions.yml b/.github/workflows/update-python-versions.yml index b1d76d84..5c71de72 100644 --- a/.github/workflows/update-python-versions.yml +++ b/.github/workflows/update-python-versions.yml @@ -17,8 +17,21 @@ permissions: jobs: update-python-versions: runs-on: ubuntu-latest + if: github.repository == 'trinodb/trino-python-client' steps: + # GITHUB_TOKEN cannot push changes to .github/workflows/. + # PRs it opens also do not trigger CI. + - name: Generate token + id: generate_token + # fork of tibdex/github-app-token + uses: trinodb/github-actions/github-app-token@2c3f458fcad343199d0e92badaaa6e9dd7993b2e + with: + app_id: ${{ secrets.SERVICE_ACCOUNT_APP_ID }} + private_key: ${{ secrets.SERVICE_ACCOUNT_PRIVATE_KEY }} + - uses: actions/checkout@v6 + with: + token: ${{ steps.generate_token.outputs.token }} - uses: actions/setup-python@v6 with: @@ -55,7 +68,7 @@ jobs: - name: Create pull request if: steps.check_changes.outputs.changed == 'true' env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.generate_token.outputs.token }} run: | EXISTING_PR=$(gh pr list --head bot/update-python-versions --json number --jq '.[0].number // empty' 2>/dev/null || echo "") if [ -z "$EXISTING_PR" ]; then