diff --git a/.github/workflows/handle_external_pr.yml b/.github/workflows/handle_external_pr.yml new file mode 100644 index 0000000..13c059d --- /dev/null +++ b/.github/workflows/handle_external_pr.yml @@ -0,0 +1,24 @@ +name: Label pull requests from forks + +on: + pull_request: + types: [opened] + +jobs: + handle_external_pr: + # Only run this entire workflow if the PR was opened from a forked repo + # The reasoning is that both bots and external contributors have to make + # a fork of the repo before they can open a PR because they don't have + # write access to the repo. + if: github.event.pull_request.head.repo.full_name != github.repository + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.NB_PROJECT_PAT }} + + steps: + - name: Add PR to project + run: | + gh pr edit ${{ github.event.pull_request.url }} --add-project Neurobagel + + - name: Label pull request with "_community" + run: gh pr edit ${{ github.event.pull_request.number }} --add-label "_community"