| 1 |
name: Backport |
| 2 |
on: |
| 3 |
pull_request_target: |
| 4 |
types: |
| 5 |
- closed |
| 6 |
- labeled |
| 7 |
|
| 8 |
permissions: |
| 9 |
contents: read |
| 10 |
|
| 11 |
jobs: |
| 12 |
backport: |
| 13 |
name: Backport |
| 14 |
runs-on: ubuntu-latest |
| 15 |
environment: |
| 16 |
name: Backport |
| 17 |
deployment: false |
| 18 |
# Only react to merged PRs for security reasons. |
| 19 |
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. |
| 20 |
if: > |
| 21 |
github.event.pull_request.merged && ( |
| 22 |
github.event.action == 'closed' |
| 23 |
|| ( |
| 24 |
github.event.action == 'labeled' |
| 25 |
&& contains(github.event.label.name, 'backport') |
| 26 |
) |
| 27 |
) |
| 28 |
steps: |
| 29 |
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 |
| 30 |
id: app-token |
| 31 |
with: |
| 32 |
client-id: ${{ vars.BACKPORT_CLIENT_ID }} |
| 33 |
private-key: ${{ secrets.PRIVATE_KEY }} |
| 34 |
permission-contents: write # push branch to Github |
| 35 |
permission-pull-requests: write # create PR / add comment for manual backport |
| 36 |
permission-workflows: write # modify files in .github/workflows |
| 37 |
- uses: pylint-dev/backport@3adad52e5a8ba2ea731c32037442d507eed68b4c # v2.1.8 |
| 38 |
with: |
| 39 |
github_token: ${{ steps.app-token.outputs.token }} |
| 40 |
user_name: ${{ vars.BACKPORT_USER_NAME }} |
| 41 |
user_email: ${{ vars.BACKPORT_USER_EMAIL }} |