GitHub Action
Repo Pruner
Repo Pruner is a GitHub Action designed to help maintain clean and organized repositories by monitoring inactive branches. This tool scans for branches that have been inactive for a specified duration and creates a summary issue listing their status. The issue includes details like the branch name, the last commit date, whether the branch has been merged, and any associated pull requests, allowing your team to review and decide on further actions.
- Scans branches for inactivity based on the number of days since the last commit.
- Ignores protected branches and lists all others in a summary issue.
- Displays the status of each branch (e.g., merged, unmerged).
- Includes links to associated pull requests or marks branches without PRs as "None."
- Provides a customizable inactivity threshold.
- Preserves the history of summary issues by closing the previous summary issue before creating a new one.
- Allows developers to mark branches as Keep or Delete via checkboxes for clear communication.
When Repo Pruner runs, it:
- Scans all branches for inactivity based on the specified threshold.
- Checks for an existing summary issue labeled "Repo Pruner Summary."
- Closes the existing summary issue, preserving it for historical reference.
- Creates a new summary issue with the latest list of inactive branches and updated details.
- Posts the new summary issue, allowing team members to review and take action on inactive branches.
This ensures that the repository stays organized, while past activity is retained for review.
To use Repo Pruner, add it to your workflow file:
name: "Run Repo Pruner"
on:
schedule:
- cron: '0 0 1 * *' # Example: Runs once a month - At 00:00 on day-of-month 1.
workflow_dispatch:
jobs:
repo-pruner:
runs-on: ubuntu-latest
steps:
- name: Run Repo Pruner
uses: arminbro/repo-pruner@v2.1.22
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
inactive_days: 30
Name | Description | Required | Default |
---|---|---|---|
inactive_days |
Number of days since the last commit before a branch is considered inactive. | No | 30 |
GITHUB_TOKEN
(required): GitHub token for authentication.
Ensure your GitHub Actions workflow has sufficient permissions to:
- Read branches
- List pull requests
- Create and close issues
Using ${{ secrets.GITHUB_TOKEN }}
should provide the necessary permissions for most standard uses.
Contributions, issues, and feature requests are welcome! Feel free to open a pull request or issue in the repository.
This project is licensed under the MIT License. See the LICENSE file for more details.