12.nixvim/.github/workflows/backport.yml
Matt Sturgeon 702008d2b3 ci/backport: specify workflows permission
Needed to create branches that modify workflow files.
2026-07-01 15:26:03 +00:00

55 lines
1.6 KiB
YAML

# Based on
# https://github.com/NixOS/nixpkgs/blob/2566f9dc/.github/workflows/backport.yml
name: Backport
on:
pull_request_target:
types:
- closed
- labeled
defaults:
run:
shell: bash
jobs:
backport:
name: Backport Pull Request
if: >
vars.CI_APP_ID
&& github.event.pull_request.merged == true
&& (
github.event.action != 'labeled'
|| startsWith(github.event.label.name, 'backport')
)
runs-on: ubuntu-24.04-arm
steps:
- name: Create GitHub App token
uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
permission-contents: write
permission-workflows: write
permission-pull-requests: write
- uses: actions/checkout@v7
with:
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.event.pull_request.head.sha }}
# Unsafely checkout the PR HEAD.
# backport-action does not execute any code from the checkout.
allow-unsafe-pr-checkout: true
# backport-action needs git credentials to operate.
persist-credentials: true
- name: Create backport PRs
id: backport
uses: korthout/backport-action@v4
with:
# See https://github.com/korthout/backport-action#inputs
github_token: ${{ steps.app-token.outputs.token }}
branch_name: backport/${target_branch}/${pull_number}
copy_labels_pattern: .*