Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GH action to automatically label community issues #4279

Merged
merged 7 commits into from
Nov 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test action
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
merelcht committed Oct 31, 2024
commit 66fdaee851c1de4275e233ca87078be415d61826
15 changes: 9 additions & 6 deletions .github/workflows/label-community-issues.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
name: Label Community Issues

on:
pull_request_target:
types:
- opened
issues:
types: [opened]
types:
- opened

jobs:
label_external_issues:
runs-on: ubuntu-latest
steps:
- name: Check if issue author is a member
- name: Check if issue author is a member of Kedro org
id: check_author
uses: actions/github-script@v6
with:
script: |
const { owner, repo } = context.repo;
const issueAuthor = context.payload.issue.user.login;

// Check if the issue author is a member of the org
const { data: membership } = await github.orgs.getMembershipForUser({
org: owner,
org: "kedro-org",
username: issueAuthor
}).catch(() => ({ data: null }));

console.log(data)
// Set an output for the membership status
return membership ? 'internal' : 'external';
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Label issue if author is external
if: steps.check_author.outputs.result == 'external'
if: steps.check_author.outputs.result == 'internal'
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}