Skip to content

Commit 6723a55

Browse files
committed
get actor
actions#100
1 parent e86574e commit 6723a55

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/labeler.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ export async function run() {
2222
console.log("Could not get pull request number from context, exiting");
2323
return;
2424
}
25+
const actor = getActor();
2526
/* TODO
2627
*
2728
* [Assigns labels based on branch names](https://github.com/actions/labeler/pull/203/files)
2829
* [Assign label based on status](https://github.com/actions/labeler/pull/79/files)
2930
*
30-
* - [ ] if list is nonempty, get actor https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L17
31+
* - [x] get actor https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L17
3132
* - [ ] find actor in list of provided actors
3233
* - [ ] if found, add label(s)
3334
* - [ ] if not found, do nothing
@@ -81,6 +82,15 @@ function getPrNumber(): number | undefined {
8182
return pullRequest.number;
8283
}
8384

85+
function getActor(): string[] {
86+
const actor = github.context.actor;
87+
if (!actor) {
88+
return undefined;
89+
}
90+
91+
return actor;
92+
}
93+
8494
async function getChangedFiles(
8595
client: ClientType,
8696
prNumber: number

0 commit comments

Comments
 (0)