Perform branch cleanup from APG trigger #198
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: 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" |