diff --git a/.github/workflows/warn_main_pr.yml b/.github/workflows/warn_main_pr.yml new file mode 100644 index 00000000..c24b78f1 --- /dev/null +++ b/.github/workflows/warn_main_pr.yml @@ -0,0 +1,27 @@ +name: Warn PR targets main + +on: + pull_request_target: + types: [opened, edited] + branches: + - main + +jobs: + warn: + if: github.repository_owner == 'loopandlearn' + runs-on: ubuntu-latest + + permissions: + pull-requests: write + + steps: + - name: Comment on PR + uses: actions/github-script@v7 + with: + script: | + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: '⚠️ This PR targets the `main` branch. We do not accept PRs directly to `main` — please retarget your PR to the `dev` branch instead.' + });