-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
65 lines (62 loc) · 2.5 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# action.yml
name: 'Delete abandoned branches'
description: |
Deletes old branches from your repo as long as they aren't part of an open pull request, the default branch, or protected.
author: Luis Pabon (PHPDocker.io)
branding:
icon: git-branch
color: orange
inputs:
ignore_branches:
description: "Comma-separated list of branches to ignore and never delete. You don't need to add your protected branches here."
required: false
default: ""
last_commit_age_days:
description: "How old in days must be the last commit into the branch for the branch to be deleted."
required: false
default: "60"
allowed_prefixes:
description: "Comma-separated list of prefixes a branch must match to be deleted."
required: false
default: ""
dry_run:
description: "Whether we're actually deleting branches at all. Defaults to 'yes'. Possible values: yes, no (case sensitive)"
required: true
github_token:
description: "The github token to use on requests to the github api"
required: true
github_base_url:
description: "The API base url to be used in requests to GitHub Enterprise"
required: false
default: "https://api.github.com"
branch_limit:
description: "The max number of branches that can be deleted"
required: false
default: "100"
only_closed_prs:
description: "Whether we're only deleting branches that belong to closed PRs. Defaults to 'no'. Possible values: yes, no (case sensitive)"
required: false
default: "no"
outputs:
deleted_branches: # id of output
description: 'Branches that have been deleted, if any'
value: ${{ steps.delete-branches-action.outputs.deleted_branches }}
runs:
using: 'composite'
steps:
- name: Install Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 #v4.7.1
with:
python-version: '3.11'
- name: Install Dependencies
run: pip install -r "${{ github.action_path }}/requirements.txt"
shell: bash
- name: Run Action
id: delete-branches-action
run: |
python3 "${{ github.action_path }}/main.py" --ignore-branches=${{ inputs.ignore_branches }} \
--last-commit-age-days=${{ inputs.last_commit_age_days }} --allowed-prefixes=${{ inputs.allowed_prefixes }} \
--dry-run=${{ inputs.dry_run }} --github-token=${{ inputs.github_token }} \
--github-base-url=${{ inputs.github_base_url }} --branch-limit=${{ inputs.branch_limit }} \
--only-closed-prs=${{ inputs.only_closed_prs }}
shell: bash