T0000: test-7 a #4
Workflow file for this run
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: Cleanup pr mirror branch | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- current | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to delete' | |
required: true | |
permissions: | |
contents: write | |
jobs: | |
delete_branch: | |
if: ${{ (github.event_name == 'workflow_dispatch' || startsWith(github.event.pull_request.head.ref, 'mirror/current/')) && github.repository != 'vyos' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Delete branch | |
run: | | |
branch=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.event.pull_request.head.ref }} | |
if [[ $branch != mirror/current/* ]]; then | |
echo "Branch name to clean must start with 'mirror/current/'" | |
exit 1 | |
fi | |
repo=${{ github.repository }} | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git push origin --delete $branch |