mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-01-31 11:17:10 +08:00
Ensure creating comments cannot fail job.
This commit is contained in:
parent
d53592711c
commit
79e8ca0cfa
7
dist/cleanup/index.js
generated
vendored
7
dist/cleanup/index.js
generated
vendored
@ -74521,7 +74521,12 @@ function createPRComment(content) {
|
||||
throw new Error('Not a PR event.');
|
||||
}
|
||||
const context = github.context;
|
||||
yield github.getOctokit(getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content }));
|
||||
try {
|
||||
yield github.getOctokit(getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content }));
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.createPRComment = createPRComment;
|
||||
|
7
dist/main/index.js
generated
vendored
7
dist/main/index.js
generated
vendored
@ -75268,7 +75268,12 @@ function createPRComment(content) {
|
||||
throw new Error('Not a PR event.');
|
||||
}
|
||||
const context = github.context;
|
||||
yield github.getOctokit(getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content }));
|
||||
try {
|
||||
yield github.getOctokit(getGitHubToken()).rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: (_a = context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number, body: content }));
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.createPRComment = createPRComment;
|
||||
|
16
src/utils.ts
16
src/utils.ts
@ -127,9 +127,15 @@ export async function createPRComment(content: string): Promise<void> {
|
||||
throw new Error('Not a PR event.')
|
||||
}
|
||||
const context = github.context
|
||||
await github.getOctokit(getGitHubToken()).rest.issues.createComment({
|
||||
...context.repo,
|
||||
issue_number: context.payload.pull_request?.number as number,
|
||||
body: content
|
||||
})
|
||||
try {
|
||||
await github.getOctokit(getGitHubToken()).rest.issues.createComment({
|
||||
...context.repo,
|
||||
issue_number: context.payload.pull_request?.number as number,
|
||||
body: content
|
||||
})
|
||||
} catch (err) {
|
||||
core.error(
|
||||
`Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user