Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b27579d

Browse files
committedMar 24, 2025·
Add stale repos action
Signed-off-by: Matej Feder <matej.feder@dnation.cloud>
1 parent 385d5e3 commit b27579d

File tree

3 files changed

+158
-0
lines changed

3 files changed

+158
-0
lines changed
 

‎.github/workflows/inactive-users.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: inactive user identifier
3+
4+
"on":
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- get_stale # for testing only - remove!
10+
schedule:
11+
- cron: "3 2 1 * *"
12+
13+
permissions:
14+
contents: read
15+
issues: write
16+
17+
jobs:
18+
build:
19+
name: inactive user identifier
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Analyze User Activity
24+
id: analyze_user_activity
25+
uses: peter-murray/inactive-users-action@v1
26+
with:
27+
token: ${{ secrets.GHP_MFEDER }}
28+
organization: SovereignCloudStack
29+
activity_days: 365
30+
31+
- name: Save User Activity Report
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: reports
35+
path: |
36+
${{ steps.analyze_user_activity.outputs.report_csv }}

‎.github/workflows/inactive-users2.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Detect Inactive Members
2+
3+
"on":
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- get_stale # for testing only - remove!
9+
schedule:
10+
- cron: "3 2 1 * *"
11+
12+
jobs:
13+
check-inactive-members:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Ruby
21+
uses: ruby/setup-ruby@v1
22+
with:
23+
ruby-version: '3.0' # Use appropriate Ruby version
24+
25+
- name: Install dependencies
26+
run: |
27+
gem install octokit dotenv
28+
29+
- name: Run inactive members script
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
ORG_NAME: "your-org-name" # Replace with your GitHub organization name
33+
run: |
34+
ruby path/to/find-inactive-members.rb

‎.github/workflows/stale-repos.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: stale repo identifier
3+
4+
"on":
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- get_stale # for testing only - remove!
10+
schedule:
11+
- cron: "3 2 1 * *"
12+
13+
permissions:
14+
contents: read
15+
issues: write
16+
17+
jobs:
18+
build:
19+
name: Stale repo identifier
20+
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
days: [335, 365]
24+
25+
permissions:
26+
contents: read
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Run stale_repos tool
32+
uses: github/stale-repos@v2.1.3
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
ORGANIZATION: SovereignCloudStack
36+
INACTIVE_DAYS: ${{ matrix.days }}
37+
ACTIVITY_METHOD: "pushed"
38+
ADDITIONAL_METRICS: "release,pr"
39+
40+
- name: Rename report file
41+
run: mv stale_repos.md stale_repos_${{ matrix.days }}.md
42+
43+
- name: Upload stale report artifact
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: stale_repos_report_${{ matrix.days }}
47+
path: stale_repos_${{ matrix.days }}.md
48+
49+
create-issue:
50+
name: Create or update stale repo issue
51+
runs-on: ubuntu-latest
52+
needs: build # Runs after all matrix jobs finish
53+
54+
permissions:
55+
issues: write
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Download all stale report artifacts
61+
uses: actions/download-artifact@v4
62+
with:
63+
path: stale_reports
64+
65+
- name: Merge reports
66+
run: |
67+
echo "# Stale Repository Report" > final_stale_repos.md
68+
for file in stale_reports/**/stale_repos_*.md; do
69+
days=$(echo "$file" | grep -oE '[0-9]+')
70+
echo "## Report for $days days" >> final_stale_repos.md
71+
cat "$file" >> final_stale_repos.md
72+
echo "" >> final_stale_repos.md
73+
done
74+
75+
- name: Check for the stale report issue
76+
run: |
77+
ISSUE_NUMBER=$(gh search issues "Stale repository report" --match title --json number --jq ".[0].number")
78+
echo "issue_number=$ISSUE_NUMBER" >> "$GITHUB_ENV"
79+
env:
80+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Create or update issue
83+
uses: peter-evans/create-issue-from-file@v5
84+
with:
85+
issue-number: ${{ env.issue_number }}
86+
title: Stale repository report
87+
content-filepath: ./final_stale_repos.md
88+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)