Skip to content

Commit b917eb6

Browse files
committed
Add stale repos action
Signed-off-by: Matej Feder <[email protected]>
1 parent 385d5e3 commit b917eb6

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed
Lines changed: 36 additions & 0 deletions
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 }}
Lines changed: 34 additions & 0 deletions
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

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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/[email protected]
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: Append results to report
41+
run: |
42+
echo "### Stale Repository Report for ${DAYS} Days" >> stale_repos_output.md
43+
echo '---' >> stale_repos.md
44+
cat stale_repos.md >> stale_repos_output.md
45+
echo '---' >> stale_repos_output.md
46+
env:
47+
DAYS: ${{ matrix.days }}
48+
49+
- name: Upload stale report artifact
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: stale_repos_report
53+
path: stale_repos_output.md
54+
55+
create-issue:
56+
name: Create or update stale repo issue
57+
runs-on: ubuntu-latest
58+
needs: build # Runs after all matrix jobs finish
59+
60+
permissions:
61+
issues: write
62+
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- name: Download stale report artifact
67+
uses: actions/download-artifact@v3
68+
with:
69+
name: stale_repos_report
70+
path: .
71+
72+
- name: Check for the stale report issue
73+
run: |
74+
ISSUE_NUMBER=$(gh search issues "Stale repository report" --match title --json number --jq ".[0].number")
75+
echo "issue_number=$ISSUE_NUMBER" >> "$GITHUB_ENV"
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Create or update issue
80+
uses: peter-evans/create-issue-from-file@v5
81+
with:
82+
issue-number: ${{ env.issue_number }}
83+
title: Stale repository report
84+
content-filepath: ./stale_repos_output.md
85+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)