# Canonical invocation: python -m <module>
name: Repository maintenance

on:
  schedule:
    - cron: "17 14 * * 1"
  workflow_dispatch:

permissions:
  contents: read
  pull-requests: read

jobs:
  maintenance-report:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.12"

      - name: Build maintenance report
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: python -m tools.ci.github_maintenance_report --output github-maintenance-report.md --json-output github-maintenance-report.json

      - name: Upload maintenance report
        uses: actions/upload-artifact@v4
        with:
          name: github-maintenance-report
          path: |
            github-maintenance-report.md
            github-maintenance-report.json
