generated from w3c/wai-resource-template
-
Notifications
You must be signed in to change notification settings - Fork 14
28 lines (25 loc) · 984 Bytes
/
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
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:
- name: Check if branch exists
id: check_if_exists
run: |
OUTPUT=$(git ls-remote --heads https://github.com/${{ github.repository_owner }}/wai-aria-practices.git apg/${{ github.event.inputs.apg_branch }} | wc -l)
echo "::set-output name=branch-exists::$(echo $OUTPUT)"
- name: Clean up generated branch
if: ${{ steps.check_if_exists.outputs.branch-exists == '1' }}
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ github.token }}
branches: apg/${{ github.event.inputs.apg_branch }}
- name: Report branch already removed
if: ${{ steps.check_if_exists.outputs.branch-exists == '0' }}
run: echo "Branch already removed"