135
shell: pwsh
136
run: Invoke-WebRequest -Uri "https://aka.ms/wingetcreate/latest" -OutFile wingetcreate.exe
137
138
- # File the tracking issue first, as a separate identity (WINGET_ISSUE_TOKEN),
139
- # so the manifest PR that wingetcreate opens next can resolve it. winget-pkgs
140
- # asks submitters to link an issue; filing it here means the "Set the winget
141
- # PR body" step can tick "Linked to an issue" and add "Resolves #N".
142
- - name: File the winget tracking issue
138
+ # winget-pkgs convention: file the "please add/update this package"
139
+ # Package Request issue *first*, then open the manifest PR that fulfils
140
+ # it with "Resolves #N". The other way round reads as a request and its
141
+ # fix posted seconds apart.
142
+ #
143
+ # The issue and the PR are authored by two separate PATs, both with
144
+ # public_repo scope on microsoft/winget-pkgs (fork + open issues/PRs):
145
+ # WINGET_ISSUE_TOKEN files the Package Request issue.
146
+ # WINGET_PR_TOKEN opens the manifest PR. It also needs read:org and
147
+ # read:discussion: the "Set the winget PR body" step
148
+ # calls `gh pr edit`, whose GraphQL query resolves
149
+ # org/team and discussion fields and fails with a
150
+ # scope error without them.
151
+ - name: File the winget Package Request issue
152
id: issue
153
shell: bash
154
env:
157
set -euo pipefail
158
159
if [ -z "${GH_TOKEN:-}" ]; then
151
- echo "::error::WINGET_ISSUE_TOKEN is not set. It needs a PAT that can open issues on microsoft/winget-pkgs."
160
+ echo "::error::WINGET_ISSUE_TOKEN is not set. It needs a PAT (public_repo) for the account that should author the Package Request issue."
161
exit 1
162
fi
163
164
VERSION="${{ steps.release.outputs.version }}"
165
TAG="${{ steps.release.outputs.tag }}"
157
- BASE="https://github.com/${REPO}/releases/download/${TAG}"
158
-
159
- if [ "${{ steps.exists.outputs.found }}" = "false" ]; then
160
- TITLE="New package: ${PACKAGE_IDENTIFIER} version ${VERSION}"
161
- ACTION="Add"
162
- else
163
- TITLE="Update: ${PACKAGE_IDENTIFIER} to version ${VERSION}"
164
- ACTION="Update"
165
- fi
166
-
167
- BODY=$(cat <<EOF
168
- ${ACTION} ${PACKAGE_IDENTIFIER} to version ${VERSION}.
169
-
170
- - Release: https://github.com/${REPO}/releases/tag/${TAG}
171
- - Installer (x64): ${BASE}/splitfire-agent-windows-x64.zip
166
+ INSTALLER="https://github.com/${REPO}/releases/download/${TAG}/splitfire-agent-windows-x64.zip"
167
+
168
+ # winget-pkgs' Package Request is an issue *form*
169
+ # (.github/ISSUE_TEMPLATE/package_request.yml): the title must be
170
+ # "[Package Request]: ..." and the body has to carry the labelled
171
+ # fields below (Installer Url especially). A free-text body lands as
172
+ # Needs-Triage and can't be acted on.
173
+ ISSUE_BODY=$(cat <<EOF
174
+ Download Page Url: https://github.com/${REPO}/releases/tag/${TAG}
175
+ Publisher: SplitFireAI
176
+ Package Name: SplitFire Agent
177
+ Description: Music-domain ACP agent for theory, production, industry, culture and live shows.
178
+ Package Version: ${VERSION}
179
+ Installer Url: ${INSTALLER}
180
EOF
181
)
182
183
ISSUE_URL=$(gh issue create \
184
--repo microsoft/winget-pkgs \
177
- --title "$TITLE" \
178
- --body "$BODY")
185
+ --title "[Package Request]: ${PACKAGE_IDENTIFIER} ${VERSION}" \
186
+ --body "$ISSUE_BODY")
187
+
188
+ echo "Opened issue ${ISSUE_URL}"
189
+ echo "issue_url=${ISSUE_URL}" >> "$GITHUB_OUTPUT"
190
+ echo "issue_number=${ISSUE_URL##*/}" >> "$GITHUB_OUTPUT"
191
180
- echo "Filed ${ISSUE_URL}"
181
- ISSUE_NUMBER="${ISSUE_URL##*/}"
182
- echo "issue_number=${ISSUE_NUMBER}" >> "$GITHUB_OUTPUT"
192
+ # Leave a gap so the issue and the PR aren't posted seconds apart.
193
+ - name: Wait before opening the PR
194
+ if: steps.issue.outputs.issue_number != ''
195
+ shell: bash
196
+ run: sleep $(( RANDOM % 61 + 150 ))
197
198
- name: Submit new package
199
id: submit_new
203
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_PR_TOKEN }}
204
run: |
205
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."
206
+ 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."
207
}
208
209
$version = "${{ steps.release.outputs.version }}"
237
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_PR_TOKEN }}
238
run: |
239
if (-not $env:WINGET_CREATE_GITHUB_TOKEN) {
226
- 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."
240
+ 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."
241
}
242
243
$tag = "${{ steps.release.outputs.tag }}"
303
"- [x] Have you checked that there aren't other open [pull requests](https://github.com/microsoft/winget-pkgs/pulls) for the same manifest update/change?" \
304
"- [x] Have you validated your manifest locally with \`winget validate --manifest <path>\`?" \
305
"- [x] Have you tested your manifest locally with \`winget install --manifest <path>\`?" \
292
- "- [x] Does your manifest conform to the [1.6 schema](https://github.com/microsoft/winget-pkgs/tree/master/doc/manifest/schema/1.6.0)?" \
306
+ "- [x] Does your manifest conform to the [1.12 schema](https://github.com/microsoft/winget-pkgs/tree/master/doc/manifest/schema/1.12.0)?" \
307
"- [x] This PR is linked to an issue.")
308
309
gh pr edit "$PR_NUMBER" \