Skip to content

Commit 7f6617a

Browse files
ci: allow backport workflow to use a PAT to trigger downstream CI (#655) (#853) (#857)
PRs opened with the default GITHUB_TOKEN do not trigger downstream pull_request workflows (an anti-recursion safeguard), which is why backport PRs land without CI running on them. Read the github_token from BACKPORT_PAT first and fall back to GITHUB_TOKEN, so configuring a repo/org secret named BACKPORT_PAT (PAT with repo scope) unlocks CI on backport PRs without any further code change. Behavior is unchanged when the secret is not configured. (cherry picked from commit 9d9db1d)
1 parent 4f007e3 commit 7f6617a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/backport.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ jobs:
2323
- name: Backport Action
2424
uses: sqren/backport-github-action@v8.9.3
2525
with:
26-
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
# Prefer a PAT when configured. PRs opened with the default
27+
# GITHUB_TOKEN don't trigger downstream `pull_request` workflows
28+
# (anti-recursion limit), which means CI does not run on backport
29+
# PRs. Configure a repo or org secret named BACKPORT_PAT
30+
# (PAT with `repo` scope) to fix that. Falls back to GITHUB_TOKEN
31+
# if the secret is not set, preserving the prior behavior.
32+
github_token: ${{ secrets.BACKPORT_PAT || secrets.GITHUB_TOKEN }}
2733
auto_backport_label_prefix: auto-backport-to-
2834
add_original_reviewers: true
2935

0 commit comments

Comments
 (0)