Prune Branches #133
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: Prune Branches | |
on: | |
workflow_dispatch: | |
inputs: | |
days: | |
description: 'Branches older than this amount of days will be deleted' | |
required: true | |
default: '90' | |
type: string | |
maximum: | |
description: 'Maximum limit of branches to delete for a single run' | |
required: true | |
default: '500' | |
type: string | |
push: | |
paths: | |
- '.github/workflows/prune_branches.yml' | |
schedule: | |
- cron: '0 */12 * * *' | |
jobs: | |
remove: | |
name: Remove Old Branches | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Arrow | |
shell: bash | |
run: git clone https://github.com/apache/arrow | |
- name: Checkout Crossbow | |
shell: bash | |
run: git clone https://github.com/ursacomputing/crossbow | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Install Archery | |
shell: bash | |
run: pip install -e arrow/dev/archery[crossbow] | |
- name: Delete Branches | |
shell: bash | |
env: | |
CROSSBOW_GITHUB_TOKEN: ${{ secrets.CROSSBOW_GITHUB_TOKEN }} | |
run: archery crossbow delete-old-branches --days ${{ github.event.inputs.days || '90'}} --maximum ${{ github.event.inputs.maximum || '500'}} |