Skip to content

Commit 1d2ce59

Browse files
authored
test update to GH action for issue creation
1 parent bce3391 commit 1d2ce59

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/extensions.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,38 @@ jobs:
1515
with:
1616
project-url: https://github.com/orgs/patternfly/projects/7
1717
github-token: ${{ secrets.GH_PROJECTS }}
18+
label-issue:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check if the author is on the team
22+
id: check_team_membership
23+
uses: actions/github-script@v6
24+
with:
25+
script: |
26+
const org = 'patternfly';
27+
const team_slug = 'frequent-flyers';
28+
const author = context.payload.issue.user.login;
29+
30+
try {
31+
const { data: membership } = await github.teams.getMembershipForUserInOrg({
32+
org: org,
33+
team_slug: team_slug,
34+
username: author
35+
});
36+
37+
if (membership && membership.state === 'active') {
38+
core.setOutput('is_team_member', 'true');
39+
} else {
40+
core.setOutput('is_team_member', 'false');
41+
}
42+
} catch (error) {
43+
// If the user is not a team member, it will throw a 404 error
44+
core.setOutput('is_team_member', 'false');
45+
}
46+
47+
- name: Add label if user is a team member
48+
if: steps.check_team_membership.outputs.is_team_member == 'true'
49+
uses: actions-ecosystem/action-add-labels@v1
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
labels: "frequent-flyer"

0 commit comments

Comments
 (0)