You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]]; then
15
+
# Check if PR is from the master/main branch of a fork
16
+
if [[ "${{ github.event.pull_request.head.ref }}" == "master" || "${{ github.event.pull_request.head.ref }}" == "main" ]]; then
17
+
echo "ERROR: Pull requests from the master/main branch of forks are not allowed, because it prevents maintainers from contributing to your PR"
18
+
echo "Please create a feature branch in your fork and submit the PR from that branch instead."
19
+
exit 1
20
+
fi
21
+
fi
22
+
23
+
- name: Leave comment if PR is from master/main branch of fork d
24
+
if: ${{ failure() }}
25
+
uses: actions/github-script@v6
26
+
with:
27
+
github-token: ${{ secrets.GITHUB_TOKEN }}
28
+
script: |
29
+
github.rest.issues.createComment({
30
+
issue_number: context.issue.number,
31
+
owner: context.repo.owner,
32
+
repo: context.repo.repo,
33
+
body: '⚠️ **ERROR:** Pull requests from the `master`/`main` branch of forks are not allowed, because it prevents maintainers from contributing to your PR. Please create a feature branch in your fork and submit the PR from that branch instead.'
0 commit comments