Stale Issue Cleanup #7
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 Issue Cleanup | |
| # # Authentication | |
| # | |
| # This workflow uses a single token, `STALE_ISSUES_TOKEN`, for all operations. | |
| # | |
| # `STALE_ISSUES_TOKEN` is a Classic PAT with the following scopes: | |
| # | |
| # - `repo` — lets the gh CLI comment on and close issues | |
| # - `read:org` — required to list members of the microsoft/azure-storage-explorer team | |
| # - `copilot` — required by the Copilot CLI for model inference (this is why github.token | |
| # cannot be used: it is a machine installation token, not a user PAT, and | |
| #. the Copilot CLI rejects it regardless of any `permissions` block settings) | |
| # - `project` — required to update the Resolution field on the org-level project | |
| # | |
| # `read:org` and `project` are org-level scopes that cannot be granted to github.token via | |
| # the workflow `permissions` block, which is why an external PAT is always required here. | |
| # | |
| # Because `GH_TOKEN` is set to this PAT, both the Copilot CLI (for model inference) and the | |
| # gh CLI (for GitHub API calls) pick it up automatically. | |
| # | |
| # For production, consider replacing this PAT with a GitHub App token for the gh CLI calls | |
| # (org membership, issue operations, project updates), using `actions/create-github-app-token`. | |
| # Note that a GitHub App cannot hold a Copilot seat, so Copilot inference will always require | |
| # a user PAT with the `copilot` scope. | |
| # | |
| # # Install Step Note | |
| # | |
| # The "Install Copilot CLI" step downloads from gh.io/copilot-install, which is a public | |
| # GitHub URL that completes in ~3 seconds on GitHub-hosted runners. | |
| on: | |
| schedule: | |
| - cron: "0 9 1,15 * *" # Twice monthly | |
| workflow_dispatch: # Allow manual triggers | |
| permissions: | |
| contents: read | |
| jobs: | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Copilot CLI | |
| run: | | |
| curl -fsSL https://gh.io/copilot-install | bash | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| - name: Run stale issue cleanup agent | |
| env: | |
| GH_TOKEN: ${{ secrets.STALE_ISSUES_TOKEN }} | |
| run: | | |
| copilot \ | |
| --agent issue-manager \ | |
| --prompt "Find and close stale bug issues." \ | |
| --allow-all-tools \ | |
| --share stale-cleanup-log.md | |
| - name: Upload session log | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stale-cleanup-log-${{ github.run_id }} | |
| path: stale-cleanup-log.md | |
| retention-days: 30 |