Skip to content

Commit d5c8091

Browse files
authored
Fix issues with issue management workflow
1 parent 8f216aa commit d5c8091

1 file changed

Lines changed: 47 additions & 16 deletions

File tree

.github/workflows/stale-issue-cleanup.yml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,55 @@
11
name: Stale Issue Cleanup
22

3-
# Authentication:
4-
# This workflow requires a token with the following scopes:
5-
# - issues:write (to comment on and close issues)
6-
# - read:org (to read team membership)
7-
# - read:project and project (to update the Resolution project field)
8-
# For experimentation, use a PAT stored as STALE_ISSUES_TOKEN repo secret.
9-
# For production, replace with a GitHub App token to avoid manual renewal:
10-
# - Register one "Storage Explorer Automation" GitHub App in the microsoft org
11-
# - Grant it issues:write, members:read, and projects:write permissions
12-
# - Install it on this repo (and any other repos your agents need)
13-
# - Use actions/create-github-app-token to generate tokens at runtime
14-
# - One app can serve all agent workflows
3+
# # Authentication
4+
#
5+
# This workflow uses two secrets:
6+
#
7+
# 1. `COPILOT_TOKEN` — a Fine-Grained Personal Access Token for Copilot model inference
8+
#
9+
# The Copilot CLI (v0.0.413+) accepts only OAuth tokens or Fine-Grained PATs
10+
# (prefix: github_pat_). Classic PATs (prefix: ghp_) are rejected with
11+
# "No authentication information found" regardless of which env var they are placed in
12+
# or whether they have the `copilot` scope.
13+
#
14+
# To create this token:
15+
#
16+
# - Go to github.com/settings/personal-access-tokens/new
17+
# - Resource owner: your personal account
18+
# - Repository access: None (no repository permissions needed)
19+
# - Expiration: set as appropriate
20+
# - Account permissions: Copilot Requests -> Read-only
21+
# - Store as `COPILOT_TOKEN` repo secret
22+
#
23+
# 2. `STALE_ISSUES_TOKEN` — a Classic PAT for GitHub CLI API calls
24+
#
25+
# Fine-Grained PATs in the microsoft org require org owner approval, so a Classic PAT
26+
# is used for org-level operations. Required scopes:
27+
#
28+
# - `read:org` — list members of the microsoft/azure-storage-explorer team
29+
# - `project` — update the Resolution field on the org-level project
30+
# - `repo` — comment on and close issues
31+
#
32+
# PATs are a temporary onboarding mechanism. For production, consider replacing with a
33+
# GitHub App token to avoid manual renewal:
34+
#
35+
# - Register a "Storage Explorer Automation" GitHub App in the microsoft org
36+
# - Grant it `members:read` and `projects:write` permissions
37+
# - Install it on this repo
38+
# - Use `actions/create-github-app-token` to generate tokens at runtime
39+
# Note: a GitHub App cannot hold a Copilot seat, so COPILOT_TOKEN will always require
40+
# a personal Fine-Grained PAT.
41+
#
42+
# # Install Step Note
43+
#
44+
# The "Install Copilot CLI" step downloads from gh.io/copilot-install, which is a public
45+
# GitHub URL that completes in ~3 seconds on GitHub-hosted runners.
1546

1647
on:
1748
schedule:
1849
- cron: "0 9 1,15 * *" # Twice monthly
1950
workflow_dispatch: # Allow manual triggers
2051

2152
permissions:
22-
issues: write
2353
contents: read
2454

2555
jobs:
@@ -29,16 +59,17 @@ jobs:
2959
- name: Checkout repository
3060
uses: actions/checkout@v4
3161

32-
- name: Install Agency
62+
- name: Install Copilot CLI
3363
run: |
34-
curl -sSfL https://aka.ms/InstallTool.sh | sh -s agency
64+
curl -fsSL https://gh.io/copilot-install | bash
3565
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
3666
3767
- name: Run stale issue cleanup agent
3868
env:
69+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_TOKEN }}
3970
GH_TOKEN: ${{ secrets.STALE_ISSUES_TOKEN }}
4071
run: |
41-
agency copilot \
72+
copilot \
4273
--agent issue-manager \
4374
--prompt "Find and close stale bug issues." \
4475
--allow-all-tools \

0 commit comments

Comments
 (0)