Skip to content

Perform branch cleanup from APG trigger #198

Perform branch cleanup from APG trigger

Perform branch cleanup from APG trigger #198

Workflow file for this run

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"