ci: added gh workflow that adds 'contributor' label to PRs/Issues (#11118)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
33
.github/workflows/contributors-label.yml
vendored
Normal file
33
.github/workflows/contributors-label.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: Add Contributors Label
|
||||||
|
|
||||||
|
on:
|
||||||
|
# issues:
|
||||||
|
# types: [opened]
|
||||||
|
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-contributor-label:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Add Contributor Label
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const isPR = !!context.payload.pull_request;
|
||||||
|
const issueNumber = isPR ? context.payload.pull_request.number : context.payload.issue.number;
|
||||||
|
const authorAssociation = isPR ? context.payload.pull_request.author_association : context.payload.issue.author_association;
|
||||||
|
|
||||||
|
if (authorAssociation === 'CONTRIBUTOR') {
|
||||||
|
await github.rest.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
labels: ['contributor']
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user