generated from w3c/wai-resource-template
-
Notifications
You must be signed in to change notification settings - Fork 14
35 lines (29 loc) · 1.16 KB
/
remove-branch.yml
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
name: Perform branch cleanup from APG trigger
on:
workflow_dispatch:
inputs:
apg_branch:
description: 'Name of branch to be removed'
required: true
jobs:
remove-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if branch exists
id: check_if_exists
run: |
BRANCH_EXISTS=$(git ls-remote --heads https://github.com/${{ github.repository_owner }}/wai-aria-practices.git apg/${{ github.event.inputs.apg_branch }} | wc -l)
echo "BRANCH_EXISTS=$BRANCH_EXISTS" >> "$GITHUB_OUTPUT"
- name: Clean up generated branch
if: ${{ steps.check_if_exists.outputs.BRANCH_EXISTS == '1' }}
run: |
BRANCH_NAME="apg/${{ github.event.inputs.apg_branch }}"
git config --global user.name "w3cgruntbot"
git config --global user.email "[email protected]"
git push origin --delete $BRANCH_NAME
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Report branch already removed
if: ${{ steps.check_if_exists.outputs.BRANCH_EXISTS == '0' }}
run: echo "Branch already removed"