Skip to content

Commit

Permalink
add: github backport action
Browse files Browse the repository at this point in the history
  • Loading branch information
clamoriniere committed Jul 5, 2024
1 parent 642a80c commit 271d3be
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/backport-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Backport PR
on:
pull_request_target:
types:
- closed
- labeled

jobs:
backport:
name: Backport PR
runs-on: ubuntu-latest
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
steps:
- uses: actions/create-github-app-token@7bfa3a4717ef143a604ee0a99d859b8886a96d00 # v1.9.3
id: app-token
with:
app-id: ${{ vars.DD_GITHUB_TOKEN_GENERATOR_APP_ID }}
private-key: ${{ secrets.DD_GITHUB_TOKEN_GENERATOR_PRIVATE_KEY }}
- uses: tibdex/backport@9565281eda0731b1d20c4025c43339fb0a23812e # v2.0.4
with:
label_pattern: "^backport/(?<base>([^ ]+))$"
labels_template: "<%= JSON.stringify([...labels, 'backport', 'bot']) %>"
github_token: ${{ steps.app-token.outputs.token }}
body_template: |
Backport <%= mergeCommitSha %> from #<%= number %>.
___
<%= body %>

0 comments on commit 271d3be

Please sign in to comment.