diff --git a/.github/workflows/fork-pr-comment.yml b/.github/workflows/fork-pr-comment.yml new file mode 100644 index 0000000000..7cf8e1e120 --- /dev/null +++ b/.github/workflows/fork-pr-comment.yml @@ -0,0 +1,38 @@ +name: Comment on fork pull requests + +on: + pull_request_target: + types: [opened] + +jobs: + comment: + name: Post fork PR comment + runs-on: ubuntu-latest + permissions: + pull-requests: write + if: github.event.pull_request.head.repo.full_name != github.repository + steps: + - name: Post comment + uses: actions/github-script@v7 + with: + script: | + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: [ + 'Thank you for your pull request! :tada:', + '', + 'We noticed that this PR was submitted from a fork. For the best experience with our CI system, we recommend contributing from a branch directly inside the **eic/EICrecon** repository.', + '', + 'To do so, please:', + '1. Become a member of the [**eic** organization](https://github.com/eic)', + '2. Join the **ePIC Devs** team within the organization', + '', + 'Visit [github.com/eic](https://github.com/eic) for more information and instructions on how to join.', + '', + 'Once you are a member, you will be able to push branches directly to this repository and open pull requests without needing a fork.', + '', + 'Since this pull request won't be able to be assessed and merged, you are welcome to close it when you have opened a new pull request from a branch in the repository.', + ].join('\n') + });