Skip to content

Commit

Permalink
add github workflow for backport
Browse files Browse the repository at this point in the history
Signed-off-by: Chenyang Ji <cyji@amazon.com>
  • Loading branch information
ansjcy committed Nov 5, 2024
1 parent dcda4b8 commit 9556311
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
issues:
types: [opened, reopened, transferred]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
apply-label:
runs-on: ubuntu-latest
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Backport
on:
pull_request_target:
types:
- closed
- labeled

jobs:
backport:
name: Backport
runs-on: ubuntu-latest
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
permissions:
contents: write
pull-requests: write
steps:
- name: GitHub App token
id: github_app_token
uses: tibdex/github-app-token@v2.1.0
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780

- name: Backport
uses: VachaShah/backport@v2.2.0
with:
github_token: ${{ steps.github_app_token.outputs.token }}
head_template: backport/backport-<%= number %>-to-<%= base %>
failure_labels: backport-failed
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- "*"
env:
OPENSEARCH_DASHBOARDS_VERSION: 'main'
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/delete-backport-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Delete merged branch of the backport PRs
on:
pull_request:
types:
- closed

jobs:
delete-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref,'backport/')
steps:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9556311

Please sign in to comment.