name: Backport PR to branch on: issue_comment: types: [created] schedule: # once a day at 13:00 UTC to cleanup old runs - cron: '0 13 * * *' permissions: contents: write issues: write pull-requests: write actions: write # Avoid interrupting an in-flight backport: a cancelled `git am` mid-apply would # leave a half-created branch/PR. Serialize per source PR (comment triggers) and # per ref (schedule) without cancelling running work. concurrency: group: backport-${{ github.event.issue.number || github.ref }} cancel-in-progress: false jobs: backport: if: ${{ contains(github.event.comment.body, '/backport to') || github.event_name == 'schedule' }} # Reference the reusable workflow by local path so it always resolves to the # same commit as this caller, pinning backport behavior to the triggering # commit without an expression. An expression in `uses:` (e.g. # `backport-base.yml@${{ github.sha }}`) is not a valid reusable-workflow # reference and makes GitHub emit a failed "workflow file issue" run on every # push, regardless of this workflow's declared triggers. uses: ./.github/workflows/backport-base.yml with: pr_description_template: | Backport of #%source_pr_number% to %target_branch% /cc %cc_users% secrets: inherit