Skip to content

Commit

Permalink
Save summary even if comment skipped
Browse files Browse the repository at this point in the history
Address PR comments:
- Call saveSummary
- Use getBooleanInput
  • Loading branch information
rcrowe committed Apr 10, 2024
1 parent d6d4278 commit e177917
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async function run() {
try {
const accessToken = core.getInput('access-token');
const limit = Number(core.getInput('limit'));
const skipComment = core.getInput('skip-comment') === 'true';
const skipComment = core.getBooleanInput('skip-comment');
const slowThreshold = Number(core.getInput('slow-threshold'));
const workspaceRoot =
core.getInput('workspace-root') || process.env.GITHUB_WORKSPACE || process.cwd();
Expand Down Expand Up @@ -123,23 +123,21 @@ async function run() {

if (skipComment) {
core.debug('Skipping comment creation');
core.setOutput('comment-created', 'false');
return;
}

// Create the comment (does not work in forks)
try {
await saveComment(accessToken, markdown);
} catch (error: unknown) {
core.warning(String(error));
core.notice('\nFailed to create comment on pull request. Perhaps this is ran in a fork?\n');
core.info(markdown);
} else {
// Create the comment (does not work in forks)
try {
await saveComment(accessToken, markdown);
} catch (error: unknown) {
core.warning(String(error));
core.notice('\nFailed to create comment on pull request. Perhaps this is ran in a fork?\n');
core.info(markdown);
}
}

// Create an action summary (does work in forks)
await saveSummary(markdown);

core.setOutput('comment-created', 'true');
core.setOutput('comment-created', skipComment ? 'false' : 'true');
} catch (error: unknown) {
core.setOutput('comment-created', 'false');
core.setFailed((error as Error).message);
Expand Down

0 comments on commit e177917

Please sign in to comment.