Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions .github/workflows/stale-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,9 @@
name: stale repo identifier
"on":
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: "0 1 1 * *" # Runs monthly: at 01:00 UTC on the 1st day of every month

permissions:
contents: read
issues: write

jobs:
build:
name: Stale repo identifier
Expand All @@ -38,10 +31,10 @@ jobs:
contents: read

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Run stale_repos tool
uses: github/stale-repos@v2.1.3
uses: github/stale-repos@v8.0.3
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORGANIZATION: SovereignCloudStack
Expand All @@ -53,7 +46,7 @@ jobs:
run: mv stale_repos.md stale_repos_${{ matrix.days }}.md

- name: Upload stale report artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: stale_repos_report_${{ matrix.days }}
path: stale_repos_${{ matrix.days }}.md
Expand All @@ -64,35 +57,41 @@ jobs:
needs: build # Runs after all matrix jobs finish

permissions:
contents: write
issues: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Download all stale report artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v6
with:
path: stale_reports

- name: Merge reports
run: |
echo "# Stale Repository Report" > final_stale_repos.md
echo "# Autogenerated Stale Repository Report " > final_stale_repos.md
echo "### Do not close this issue - it is autogenerated by the `stale repo identifier` action" >> final_stale_repos.md
echo "### Two thresholds are used - **335** days and **365** days - in accordance with the standard: https://github.com/SovereignCloudStack/standards/blob/main/Standards/scs-0006-v1-organization-management.md" >> final_stale_repos.md
for file in stale_reports/**/stale_repos_*.md; do
cat "$file" >> final_stale_repos.md
echo "" >> final_stale_repos.md
done

- name: Check for the stale report issue
run: |
ISSUE_NUMBER=$(gh search issues "Stale repository report" --match title --json number --jq ".[0].number")
ISSUE_NUMBER=$(gh search issues "Autogenerated Stale Repository Report (DO NOT CLOSE)" --match title --json number --jq ".[0].number")
echo "issue_number=$ISSUE_NUMBER" >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create or update issue
uses: peter-evans/create-issue-from-file@v5
uses: peter-evans/create-issue-from-file@v6
with:
issue-number: ${{ env.issue_number }}
title: Stale repository report
title: Autogenerated Stale Repository Report (DO NOT CLOSE)
content-filepath: ./final_stale_repos.md
token: ${{ secrets.GITHUB_TOKEN }}
# FIXME: GITHUB_TOKEN does not work on forks (including this repo).
# See: https://github.com/peter-evans/create-issue-from-file/issues/1673
# Remove the current PAT workaround and implement a better solution.
token: ${{ secrets.STALE_PAT }}