Skip to content

ifconfig: T6972: smoketests fail as IP address is not removed in time #18

ifconfig: T6972: smoketests fail as IP address is not removed in time

ifconfig: T6972: smoketests fail as IP address is not removed in time #18

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/')) && github.repository_owner != '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/* ]]; then
echo "Branch name to clean must start with 'mirror/'"
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