Garbage Collect Reports #5
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: Garbage Collect Reports | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 0' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| actions: write | |
| concurrency: | |
| group: gc-reports | |
| cancel-in-progress: true | |
| env: | |
| UV_FROZEN: 1 | |
| jobs: | |
| gc: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v6 | |
| - run: uv sync | |
| - run: ./maat gc-reports | |
| - name: Set up Git configuration | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com | |
| - run: git pull --ff-only | |
| - run: git add -A reports | |
| - name: Check for changes | |
| id: check_changes | |
| shell: bash | |
| run: | | |
| if git diff --cached --quiet; then | |
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - run: "git commit -m 'gc-reports: prune old reports'" | |
| if: steps.check_changes.outputs.has_changes == 'true' | |
| - run: git push | |
| if: steps.check_changes.outputs.has_changes == 'true' | |
| - name: Trigger Web workflow | |
| if: github.ref == 'refs/heads/main' && steps.check_changes.outputs.has_changes == 'true' | |
| run: gh workflow run web.yml --ref "${{ github.ref }}" | |
| env: | |
| GH_TOKEN: ${{ github.token }} |