Skip to content

Commit b59f512

Browse files
committed
github-release: create the Discussion separately
When deploying v2.46.1, trying to publish the release _and_ creating the discussion failed like this: FAILED GitHub REST API call! { port: 443, hostname: 'api.github.com', method: 'PATCH', path: '/repos/git-for-windows/git/releases/175612508', headers: { 'User-Agent': 'GitForWindowsHelperApp/0.0', Accept: 'application/json', { statusCode: 404, statusMessage: 'Not Found', body: '{"message":"Discussion could not be created. Make sure you passed a valid category name.","documentation_url":"https://docs.github.com/rest/releases/releases#update-a-release","status":"404"}', json: { message: 'Discussion could not be created. Make sure you passed a valid category name.', documentation_url: 'https://docs.github.com/rest/releases/releases#update-a-release', status: '404' } } Authorization: '***', 'Content-Type': 'application/json', 'Content-Length': 96 } } Culprit: The GitForWindowsHelper GitHub App, with whose permissions this was run, lacked the permission to create Discussions. The release was published, though... So let's separate those two steps, publishing a draft release, and adding the discussion, and do not fail the deployment if the Discussion could not be created. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 250635d commit b59f512

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/actions/github-release/action.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,26 @@ runs:
154154
draft: false,
155155
prerelease: isPrerelease,
156156
make_latest : !isPrerelease,
157-
discussion_category_name: 'Announcements',
158157
}
159158
)
160159
}
160+
161+
try {
162+
await state.refreshToken()
163+
console.log('Opening announcement (in Discussions)')
164+
await updateRelease(
165+
console,
166+
state.accessToken,
167+
'${{ inputs.owner }}',
168+
'${{ inputs.repo }}',
169+
release.id, {
170+
discussion_category_name: 'Announcements',
171+
}
172+
)
173+
} catch(e) {
174+
console.log(`::warning::could not create Discussion`)
175+
console.log(e)
176+
}
161177
- name: update check-run
162178
if: always()
163179
uses: ./.github/actions/check-run-action

0 commit comments

Comments
 (0)