Skip to content

Commit

Permalink
add label based on code owner
Browse files Browse the repository at this point in the history
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
  • Loading branch information
ashwin-pc committed Mar 19, 2024
1 parent db9806d commit fa43978
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,23 @@ jobs:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
const codeowners = await github.repos.listCodeowners({
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['untriaged']
})
repo: context.repo.repo
});
console.log(codeowners)
const issueAuthor = context.payload.issue.user.login;
const isCodeowner = codeowners.data.some(codeowner => codeowner.login === issueAuthor);
console.log(isCodeOwner)
if (!isCodeowner) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['untriaged']
});
}

0 comments on commit fa43978

Please sign in to comment.