Skip to content

Commit b32f139

Browse files
committed
Add summary
1 parent 13592be commit b32f139

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

dist/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29258,8 +29258,23 @@ async function run() {
2925829258
const userId = user.id.toString();
2925929259
if (allowedUserIds.includes(userId)) {
2926029260
core.notice(`${ansi_styles_1.default.green.open}User ${ansi_styles_1.default.bold.open}${userId}${ansi_styles_1.default.bold.close} authorized this workflow run.${ansi_styles_1.default.green.close}`);
29261+
core.summary.clear();
29262+
core.summary.addHeading("Action Authorization");
29263+
core.summary.addBreak();
29264+
core.summary.addRaw("This workflow run is authorized by ");
29265+
core.summary.addLink(`${username} (${userId})`, `https://github.com/${username}`);
29266+
core.summary.addRaw(".");
29267+
core.summary.write();
2926129268
}
2926229269
else {
29270+
core.notice(`${ansi_styles_1.default.green.open}User ${ansi_styles_1.default.bold.open}${userId}${ansi_styles_1.default.bold.close} authorized this workflow run.${ansi_styles_1.default.green.close}`);
29271+
core.summary.clear();
29272+
core.summary.addHeading("Action Authorization Failure");
29273+
core.summary.addBreak();
29274+
core.summary.addRaw("This workflow run was executed by ");
29275+
core.summary.addLink(`${username} (${userId})`, `https://github.com/${username}`);
29276+
core.summary.addRaw(" and is unauthorized!");
29277+
core.summary.write();
2926329278
throw new Error(`User ${ansi_styles_1.default.bold.open}${userId}${ansi_styles_1.default.bold.close} is not authorized to run this workflow. Aborting`);
2926429279
}
2926529280
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "execute-whitelist-action",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Action to whitelist executions",
55
"main": "index.ts",
66
"scripts": {

src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,22 @@ async function run() {
3131

3232
if (allowedUserIds.includes(userId)) {
3333
core.notice(`${styles.green.open}User ${styles.bold.open}${userId}${styles.bold.close} authorized this workflow run.${styles.green.close}`);
34+
core.summary.clear()
35+
core.summary.addHeading("Action Authorization");
36+
core.summary.addBreak()
37+
core.summary.addRaw("This workflow run is authorized by ");
38+
core.summary.addLink(`${username} (${userId})`, `https://github.com/${username}`)
39+
core.summary.addRaw(".");
40+
core.summary.write()
3441
} else {
42+
core.notice(`${styles.green.open}User ${styles.bold.open}${userId}${styles.bold.close} authorized this workflow run.${styles.green.close}`);
43+
core.summary.clear()
44+
core.summary.addHeading("Action Authorization Failure");
45+
core.summary.addBreak()
46+
core.summary.addRaw("This workflow run was executed by ");
47+
core.summary.addLink(`${username} (${userId})`, `https://github.com/${username}`)
48+
core.summary.addRaw(" and is unauthorized!");
49+
core.summary.write()
3550
throw new Error(`User ${styles.bold.open}${userId}${styles.bold.close} is not authorized to run this workflow. Aborting`);
3651
}
3752
} catch (error: any) {

0 commit comments

Comments
 (0)