30 lines
1.1 KiB
YAML
30 lines
1.1 KiB
YAML
name: Add Community Label
|
|
|
|
on:
|
|
pull_request_target:
|
|
# NOTE: pull_request_target is required to have write permissions to add labels on PRs from forks.
|
|
# This workflow must not be modified to check out or execute untrusted PR code, as it runs with base repo permissions.
|
|
types: [opened]
|
|
|
|
jobs:
|
|
add-label:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- name: Add community label
|
|
if: github.event.pull_request.author_association != 'MEMBER' && github.event.pull_request.author_association != 'OWNER' && github.event.pull_request.author_association != 'COLLABORATOR'
|
|
uses: actions/github-script@v8.0
|
|
with:
|
|
script: |
|
|
const pullRequestNumber = context.payload.pull_request.number;
|
|
const repoDetails = {
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pullRequestNumber
|
|
};
|
|
await github.rest.issues.addLabels({
|
|
...repoDetails,
|
|
labels: ['community']
|
|
});
|
|
|