File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
llvm-spirv/.github/workflows Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Cleanup Backport Branches
2
+
3
+ on :
4
+ pull_request :
5
+ types : [closed]
6
+
7
+ permissions :
8
+ contents : write
9
+
10
+ jobs :
11
+ cleanup :
12
+ if : >
13
+ github.event.pull_request.head.repo.full_name == github.repository &&
14
+ startsWith(github.event.pull_request.head.ref, 'backport/pr-')
15
+ runs-on : ubuntu-latest
16
+
17
+ steps :
18
+ - name : Delete branch
19
+ uses : actions/github-script@v7
20
+ with :
21
+ github-token : ${{ secrets.GITHUB_TOKEN }}
22
+ script : |
23
+ const branch = context.payload.pull_request.head.ref;
24
+ try {
25
+ await github.rest.git.deleteRef({
26
+ owner: context.repo.owner,
27
+ repo: context.repo.repo,
28
+ ref: `heads/${branch}`
29
+ });
30
+ console.log(`Success. Deleted '${branch}'`);
31
+ } catch (error) {
32
+ if (error.status === 422) {
33
+ console.log(`Branch '${branch}' not found`);
34
+ }
35
+ } else {
36
+ throw error;
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments