Skip to content

Commit

Permalink
Fix delete backport PR branches workflow (#1086) (#1088)
Browse files Browse the repository at this point in the history
(cherry picked from commit a3fc7da)

Signed-off-by: Thomas Farr <tsfarr@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 680f98f commit 83cafef
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/delete_backport_branch.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: Delete merged branch of the backport PRs
on:
on:
pull_request:
types:
- closed

jobs:
delete-branch:
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref,'backport/')
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id && startsWith(github.event.pull_request.head.ref, 'backport/')
permissions:
contents: write
steps:
- name: Delete merged branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/github-script@v7
with:
script: |
github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${context.payload.pull_request.head.ref}`,
})

0 comments on commit 83cafef

Please sign in to comment.