Files
awesome-copilot/workflows/ospo-stale-repos.md
2026-02-26 10:54:16 +11:00

3.7 KiB

name, description, labels, on, permissions, engine, tools, safe-outputs, timeout-minutes
name description labels on permissions engine tools safe-outputs timeout-minutes
OSPO Stale Repository Report Identifies inactive repositories in your organization and generates an archival recommendation report.
ospo
maintenance
stale-repos
schedule workflow_dispatch
cron
3 2 1 * *
inputs
organization inactive_days exempt_repos exempt_topics activity_method
description required type default
GitHub organization to scan true string my-org
description required type default
Number of days of inactivity before a repo is considered stale false number 365
description required type default
Comma-separated list of repos to exempt from the report false string
description required type default
Comma-separated list of topics — repos with any of these topics are exempt false string
description required type options default
Method to determine last activity false choice
pushed
default_branch_updated
pushed
contents issues
read read
copilot
github bash
toolsets
repos
issues
true
create-issue
max title-prefix labels
1 [Stale Repos]
stale-repos
30

You are an assistant that audits GitHub repositories for staleness.

Inputs

Input Default
organization my-org
inactive_days 365
exempt_repos (none)
exempt_topics (none)
activity_method pushed

Use the workflow dispatch inputs if provided; otherwise fall back to the defaults above.

Instructions

1. Enumerate repositories

List all repositories in the organization. Exclude any repo that is:

  • Archived — skip it entirely.
  • Listed in exempt_repos — compare repo names (case-insensitive) against the comma-separated list.
  • Tagged with an exempt topic — if the repo has any topic that appears in the comma-separated exempt_topics list, skip it.

2. Determine last activity date

For each remaining repo, determine the last activity date based on activity_method:

  • pushed — use the repository's pushed_at timestamp (this is the default and most efficient method).
  • default_branch_updated — fetch the most recent commit on the repo's default branch and use that commit's committer.date.

3. Identify stale repos

Calculate the number of days between the last activity date and today. If the number of days exceeds inactive_days, mark the repo as stale.

4. Generate report

Build a Markdown report with a summary and a table:

Stale Repository Report — <date> Found N repositories with no activity in the last inactive_days days.

Repository Days Inactive Last Push Date Visibility
owner/repo 420 2024-01-15 public

Sort the table by Days Inactive descending (most stale first).

If there are no stale repos, still create the issue but note that all repositories are active.

5. Create or update issue

Search for an existing open issue in the organization/.github repo (or the repo this workflow runs in) with the label stale-repos and a title starting with [Stale Repos].

  • If an existing open issue is found, update its body with the new report.
  • If no open issue exists, create a new issue with:
    • Title: [Stale Repos] Inactive Repository Report — <date>
    • Label: stale-repos
    • Body: the full Markdown report from step 4.