Skip to content

Commit 0e2191a

Browse files
authored
Update main.ts
1 parent fee7be6 commit 0e2191a

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/main.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,23 @@ let GIT_AUTHOR_EMAIL: string;
1717
if (core.getInput("commit-author")) {
1818
assert.equal(core.getInput("commit-author-name"), "");
1919
assert.equal(core.getInput("commit-author-email"), "");
20-
[GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL] = core
21-
.getInput("commit-author")
22-
.match(/^\s+(.+)\s+<(.+)>\s+$/)
23-
.slice(1);
20+
if (
21+
/^\s+@?github[-_]?actions(?:\[bot\])?\s+$/.test(
22+
core.getInput("commit-author")
23+
)
24+
) {
25+
GIT_AUTHOR_NAME = "github-actions[bot]";
26+
GIT_AUTHOR_EMAIL =
27+
"41898282+github-actions[bot]@users.noreply.github.com";
28+
} else if (/^\s+@?me\s+$/.test(core.getInput("commit-author"))) {
29+
GIT_AUTHOR_NAME = process.env.GITHUB_ACTOR;
30+
GIT_AUTHOR_EMAIL = `${process.env.GITHUB_ACTOR_ID}+${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
31+
} else {
32+
[GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL] = core
33+
.getInput("commit-author")
34+
.match(/^\s+(.+)\s+<(.+)>\s+$/)
35+
.slice(1);
36+
}
2437
} else {
2538
GIT_AUTHOR_NAME = core.getInput("commit-author-name", { required: true });
2639
GIT_AUTHOR_EMAIL = core.getInput("commit-author-email", { required: true });

0 commit comments

Comments
 (0)