From ec4e8522ad9e4099ac61647f7d01d0132f4fe27f Mon Sep 17 00:00:00 2001 From: Matej Feder Date: Mon, 8 Dec 2025 21:10:59 +0100 Subject: [PATCH] Update and fix stale repos action Signed-off-by: Matej Feder --- .github/workflows/stale-repos.yml | 33 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/stale-repos.yml b/.github/workflows/stale-repos.yml index 06b17cde..923cefae 100644 --- a/.github/workflows/stale-repos.yml +++ b/.github/workflows/stale-repos.yml @@ -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 @@ -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 @@ -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 @@ -64,19 +57,22 @@ 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 @@ -84,15 +80,18 @@ jobs: - 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 }}