chore: Cherry picked DIA-820 and LEAP-396 into release 1.11.0 #1546
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Delete PR branch" | |
on: | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
delete-branch: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hmarr/[email protected] | |
- name: Delete branch | |
uses: actions/github-script@v7 | |
if: startsWith(github.event.pull_request.head.ref, 'fb-') | |
env: | |
HEAD_REF: ${{ github.event.pull_request.head.ref }} | |
with: | |
script: | | |
const { repo, owner } = context.repo; | |
const head_ref = process.env.HEAD_REF; | |
await github.rest.git.deleteRef({ | |
owner, | |
repo, | |
ref: `heads/${head_ref}`, | |
}); | |
console.log(`Branch ${head_ref} is deleted`) |