Skip to content

Workflow file for this run

name: Add new issues to PatternFly Extensions project
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/patternfly/projects/7
github-token: ${{ secrets.GH_PROJECTS }}
label-issue:
runs-on: ubuntu-latest
steps:
- name: Check if the author is on the team
id: check_team_membership
uses: actions/github-script@v6
with:
script: |
try {
const { data: membership } = await github.teams.getMembershipForUserInOrg({
org: 'patternfly',
team_slug: 'frequent-flyers',
username: context.payload.issue.user.login
});
console.log(context.payload.issue.user.login);
console.log(membership);
if (membership && membership.state === 'active') {
core.setOutput('is_team_member', 'true');
} else {
core.setOutput('is_team_member', 'false');
}
} catch (error) {
// If the user is not a team member, it will throw a 404 error
core.setOutput('is_team_member', 'false');
}
- name: Add label if user is a team member
if: steps.check_team_membership.outputs.is_team_member == 'true'
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels \
-d '{"labels":["Frequent flyer"]}'