Repository navigation
51 lines (51 loc) · 1.83 KB
/
Copy pathdeleteReleaseBranch.yml
File metadata and controls
51 lines (51 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This file was automatically generated by github-actions-wac.
# DO NOT MODIFY IT BY HAND. Instead, modify the source *.wac.ts file(s)
# and run "github-actions-wac build" (or "ghawac build") to regenerate this file.
# For more information, run "github-actions-wac --help".
name: Delete Merged Release Branch
'on':
pull_request:
types:
- closed
branches:
- next
- release/*-base
jobs:
deleteBranch:
name: Delete release branch
if: >-
${{ github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.head.ref, 'release/') }}
steps:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 24
- name: Delete branch
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
REPO: ${{ github.repository }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |-
set -e
# Delete the head release branch (Y) that was just merged.
gh api --method DELETE "/repos/$REPO/git/refs/heads/$HEAD_REF"
echo "Deleted head branch: $HEAD_REF"
# For tag-based (patch) releases the PR base is a throwaway
# "release/x.y.z-base" branch (X) - delete it too. Never delete next.
case "$BASE_REF" in
release/*-base)
gh api --method DELETE "/repos/$REPO/git/refs/heads/$BASE_REF"
echo "Deleted base branch: $BASE_REF"
;;
*)
echo "Base branch $BASE_REF is not a release base branch; leaving it in place."
;;
esac
runs-on: ubuntu-latest
env:
NODE_OPTIONS: '--max_old_space_size=4096'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
permissions:
contents: read
actions: write