From 30f954c149a4bc6221c5e3123b559df5df6c55df Mon Sep 17 00:00:00 2001 From: tcdsv <33223663+tcdsv@users.noreply.github.com> Date: Sun, 25 Jun 2023 14:00:22 +0300 Subject: [PATCH] ci: auto mark pr from forks as community (#105) Closes #101 **Proposed Changes** - created the job in pr-labels.yml - updated the guidelines in pull_request_template.md I submit this contribution under the Apache-2.0 license. --- .github/pull_request_template.md | 1 - .github/workflows/pr-labels.yml | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-labels.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 718f0716..80ff933d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,6 +1,5 @@ Closes # diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml new file mode 100644 index 00000000..d1463eab --- /dev/null +++ b/.github/workflows/pr-labels.yml @@ -0,0 +1,23 @@ +name: PR Labels + +on: + pull_request_target: + types: [opened] + +jobs: + mark_as_community: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Mark as Community if PR is from a fork + if: github.event.pull_request.head.repo.full_name != github.repository + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['Community'] + })