Skip to content

Commit

Permalink
Add GH action to automatically label community issues (#4279)
Browse files Browse the repository at this point in the history
* Add GH action to automatically label community issues

Signed-off-by: Merel Theisen <[email protected]>

* Test action

Signed-off-by: Merel Theisen <[email protected]>

* Undo test stuf

Signed-off-by: Merel Theisen <[email protected]>

* Update label action

Signed-off-by: Merel Theisen <[email protected]>

* Update label action

Signed-off-by: Merel Theisen <[email protected]>

---------

Signed-off-by: Merel Theisen <[email protected]>
  • Loading branch information
merelcht authored Nov 1, 2024
1 parent 18bde07 commit 34c42fc
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/label-community-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Label Community Issues

on:
issues:
types:
- opened

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check if issue author is a member of Kedro org
uses: actions/github-script@v6
id: membership
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
try {
const result = await github.rest.orgs.getMembershipForUser({
org: "kedro-org",
username: '${{ github.actor }}'
})
console.log(result?.data?.state)
if (result?.data?.state == "active"){
console.log("%s: detected as an active member of Kedro org", '${{ github.actor }}')
return "member";
} else {
console.log("%s: not detected as active member of Kedro org", '${{ github.actor }}')
return "notMember";
}
} catch (error) {
return "notMember";
}
- name: Label issue if author is from community
if: ${{ steps.membership.outputs.result == 'notMember' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: 'Community'

0 comments on commit 34c42fc

Please sign in to comment.