@@ -20,28 +20,24 @@ jobs:
2020 steps :
2121 - name : Check if the author is on the team
2222 id : check_team_membership
23- run : |
24- const org = 'patternfly';
25- const team_slug = 'frequent-flyers';
26- const author = context.payload.issue.user.login;
27-
28- try {
29- const { data: membership } = await github.teams.getMembershipForUserInOrg({
30- org: org,
31- team_slug: team_slug,
32- username: author
33- });
34-
35- if (membership && membership.state === 'active') {
36- core.setOutput('is_team_member', 'true');
37- } else {
23+ uses : actions/github-script@v6
24+ with :
25+ script : |
26+ try {
27+ const { data: membership } = await github.teams.getMembershipForUserInOrg({
28+ org: 'patternfly',
29+ team_slug: 'frequent-flyers',
30+ username: context.payload.issue.user.login
31+ });
32+ if (membership && membership.state === 'active') {
33+ core.setOutput('is_team_member', 'true');
34+ } else {
35+ core.setOutput('is_team_member', 'false');
36+ }
37+ } catch (error) {
38+ // If the user is not a team member, it will throw a 404 error
3839 core.setOutput('is_team_member', 'false');
3940 }
40- } catch (error) {
41- // If the user is not a team member, it will throw a 404 error
42- core.setOutput('is_team_member', 'false');
43- }
44-
4541 - name : Add label if user is a team member
4642 if : steps.check_team_membership.outputs.is_team_member == 'true'
4743 uses : actions-ecosystem/action-add-labels@v1
0 commit comments