Check labels #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check labels | |
on: | |
discussion: | |
types: [labeled] | |
jobs: | |
check_labels: | |
name: Check labels | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if employee | |
id: check_employee | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.READ_GITHUB_ORG_MEMBERS_TOKEN }} | |
result-encoding: string | |
script: | | |
try { | |
const response = await github.rest.orgs.checkMembershipForUser({ | |
org: `github`, | |
username: context.payload.discussion.user.login | |
}); | |
if (response.status === 204) { | |
return true; | |
} else { | |
return false; | |
} | |
} catch (error) { | |
console.log(error); | |
return 'false'; | |
} | |
- name: Check labels | |
id: check_labels | |
if: ${{ steps.check_employee.outputs.result == 'false' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
cosnt labels = [ | |
'fixed', | |
'more information needed', | |
'in backlog' | |
]; | |
console.log(context.payload); | |
labels.forEach(label => { | |
if (context.payload.label.name === label) { | |
return true; | |
// Remove labels | |
} | |
}); |