Skip to content

Commit d7d9805

Browse files
authored
Add stale repos action (#331)
Signed-off-by: Matej Feder <[email protected]>
1 parent e09ea4e commit d7d9805

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

.github/workflows/stale-repos.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
# Stale Repository Identifier
3+
# This GitHub Action implements the repository activity monitoring requirements outlined in the Sovereign Cloud Stack Procedural Standard (SCS-0006).
4+
# Functionality
5+
# - Identifies repositories within the SovereignCloudStack organization that have been inactive for 335 or 365 days
6+
# - Reports stale repositories based on recent pushes, releases, and pull requests
7+
# - Automatically creates or updates a GitHub issue with the stale repository report
8+
# - Runs monthly (on the 1st at 01:00 UTC) and can be manually triggered
9+
#
10+
# Limitations
11+
# - The action does not exclude auto-generated PRs (e.g., Renovate, Dependabot)
12+
# - It does not handle repositories with no remaining codeowners as stale
13+
#
14+
# TODO: These limitations must be implemented via post-processing or contributed upstream.
15+
16+
name: stale repo identifier
17+
"on":
18+
workflow_dispatch:
19+
push:
20+
branches:
21+
- main
22+
schedule:
23+
- cron: "0 1 1 * *" # Runs monthly: at 01:00 UTC on the 1st day of every month
24+
25+
permissions:
26+
contents: read
27+
issues: write
28+
29+
jobs:
30+
build:
31+
name: Stale repo identifier
32+
runs-on: ubuntu-latest
33+
strategy:
34+
matrix:
35+
days: [335, 365]
36+
37+
permissions:
38+
contents: read
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Run stale_repos tool
44+
uses: github/[email protected]
45+
env:
46+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
ORGANIZATION: SovereignCloudStack
48+
INACTIVE_DAYS: ${{ matrix.days }}
49+
ACTIVITY_METHOD: "pushed"
50+
ADDITIONAL_METRICS: "release,pr"
51+
52+
- name: Rename report file
53+
run: mv stale_repos.md stale_repos_${{ matrix.days }}.md
54+
55+
- name: Upload stale report artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: stale_repos_report_${{ matrix.days }}
59+
path: stale_repos_${{ matrix.days }}.md
60+
61+
create-issue:
62+
name: Create or update stale repo issue
63+
runs-on: ubuntu-latest
64+
needs: build # Runs after all matrix jobs finish
65+
66+
permissions:
67+
issues: write
68+
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- name: Download all stale report artifacts
73+
uses: actions/download-artifact@v4
74+
with:
75+
path: stale_reports
76+
77+
- name: Merge reports
78+
run: |
79+
echo "# Stale Repository Report" > final_stale_repos.md
80+
for file in stale_reports/**/stale_repos_*.md; do
81+
cat "$file" >> final_stale_repos.md
82+
echo "" >> final_stale_repos.md
83+
done
84+
85+
- name: Check for the stale report issue
86+
run: |
87+
ISSUE_NUMBER=$(gh search issues "Stale repository report" --match title --json number --jq ".[0].number")
88+
echo "issue_number=$ISSUE_NUMBER" >> "$GITHUB_ENV"
89+
env:
90+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
92+
- name: Create or update issue
93+
uses: peter-evans/create-issue-from-file@v5
94+
with:
95+
issue-number: ${{ env.issue_number }}
96+
title: Stale repository report
97+
content-filepath: ./final_stale_repos.md
98+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)