ci(winget): space out the issue and the manifest PR (#76)
Filing the Package Request issue and opening the PR that resolves it back to back reads as automated, so sleep a randomized interval after the issue step before wingetcreate runs. Note the read:org and read:discussion scopes WINGET_PR_TOKEN needs for the gh pr edit step in the workflow comment and error messages. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: siGit Code v1.6.8-acp <noreply@sigit.si>
keypair34 committed
Oct 13, 2026 at 06:58 UTC
6828a41ee47f0268550cecb28bb2f851a15637fc
1 file changed
+12
-4
.github/workflows/release-winget.yml
+12
-4
@@ -134,8 +134,11 @@ jobs:
134
# The issue and the PR are authored by two separate PATs, configured as
135
# the repo secrets WINGET_ISSUE_TOKEN (the Package Request issue) and
136
# WINGET_PR_TOKEN (the manifest PR). Both need public_repo scope on
137
- # microsoft/winget-pkgs (fork + open issues/PRs). WINGET_PR_TOKEN
138
- # replaces the old single WINGET_TOKEN.
137
+ # microsoft/winget-pkgs (fork + open issues/PRs). WINGET_PR_TOKEN also
138
+ # needs read:org and read:discussion: the "Set the winget PR body" step
139
+ # below calls `gh pr edit`, whose GraphQL query resolves org/team and
140
+ # discussion fields and fails with a scope error without them.
141
+ # WINGET_PR_TOKEN replaces the old single WINGET_TOKEN.
142
- name: File the winget Package Request issue
143
id: issue
144
shell: bash
@@ -178,6 +181,11 @@ jobs:
181
echo "issue_url=${ISSUE_URL}" >> "$GITHUB_OUTPUT"
182
echo "issue_number=${ISSUE_URL##*/}" >> "$GITHUB_OUTPUT"
183
184
+ - name: Sebat dulu ...
185
+ if: steps.issue.outputs.issue_number != ''
186
+ shell: bash
187
+ run: sleep $(( RANDOM % 61 + 150 ))
188
+
189
- name: Submit new package
190
id: submit_new
191
if: steps.exists.outputs.found == 'false'
@@ -189,7 +197,7 @@ jobs:
197
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_PR_TOKEN }}
198
run: |
199
if (-not $env:WINGET_CREATE_GITHUB_TOKEN) {
192
- Write-Error "WINGET_PR_TOKEN is not set. It needs a PAT with public_repo scope so wingetcreate can fork microsoft/winget-pkgs and open the manifest PR."
200
+ Write-Error "WINGET_PR_TOKEN is not set. It needs a PAT with public_repo, read:org, and read:discussion scopes so wingetcreate can fork microsoft/winget-pkgs and open the manifest PR, and gh can edit the PR body."
201
}
202
203
$version = "${{ steps.release.outputs.version }}"
@@ -222,7 +230,7 @@ jobs:
230
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_PR_TOKEN }}
231
run: |
232
if (-not $env:WINGET_CREATE_GITHUB_TOKEN) {
225
- Write-Error "WINGET_PR_TOKEN is not set. It needs a PAT with public_repo scope so wingetcreate can fork microsoft/winget-pkgs and open the manifest PR."
233
+ Write-Error "WINGET_PR_TOKEN is not set. It needs a PAT with public_repo, read:org, and read:discussion scopes so wingetcreate can fork microsoft/winget-pkgs and open the manifest PR, and gh can edit the PR body."
234
}
235
236
$tag = "${{ steps.release.outputs.tag }}"