Add stale repos action #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: stale repo identifier | |
| "on": | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - get_stale # for testing only - remove! | |
| schedule: | |
| - cron: "3 2 1 * *" | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| build: | |
| name: Stale repo identifier | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| days: [335, 365] | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run stale_repos tool | |
| uses: github/[email protected] | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ORGANIZATION: SovereignCloudStack | |
| INACTIVE_DAYS: ${{ matrix.days }} | |
| ACTIVITY_METHOD: "pushed" | |
| ADDITIONAL_METRICS: "release,pr" | |
| - name: Append results to report | |
| run: | | |
| echo "### Stale Repository Report for ${DAYS} Days" >> stale_repos_output.md | |
| echo '---' >> stale_repos_output.md | |
| cat stale_repos.md >> stale_repos_output.md | |
| echo '---' >> stale_repos_output.md | |
| env: | |
| DAYS: ${{ matrix.days }} | |
| - name: Upload stale report artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stale_repos_report | |
| path: stale_repos_output.md | |
| create-issue: | |
| name: Create or update stale repo issue | |
| runs-on: ubuntu-latest | |
| needs: build # Runs after all matrix jobs finish | |
| permissions: | |
| issues: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download stale report artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: stale_repos_report | |
| path: . | |
| - name: Check for the stale report issue | |
| run: | | |
| ISSUE_NUMBER=$(gh search issues "Stale repository report" --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 | |
| with: | |
| issue-number: ${{ env.issue_number }} | |
| title: Stale repository report | |
| content-filepath: ./stale_repos_output.md | |
| token: ${{ secrets.GITHUB_TOKEN }} |