warn_main_pr.yml 730 B

12345678910111213141516171819202122232425262728
  1. name: Warn PR targets main
  2. on:
  3. pull_request_target:
  4. types: [opened, edited]
  5. branches:
  6. - main
  7. jobs:
  8. warn:
  9. if: ${{ !github.event.repository.fork }}
  10. runs-on: ubuntu-latest
  11. permissions:
  12. pull-requests: write
  13. steps:
  14. - name: Comment on PR
  15. uses: actions/github-script@v7
  16. with:
  17. script: |
  18. await github.rest.issues.createComment({
  19. owner: context.repo.owner,
  20. repo: context.repo.repo,
  21. issue_number: context.payload.pull_request.number,
  22. body: '⚠️ This PR targets the `main` branch. We do not accept PRs directly to `main` — please retarget your PR to the `dev` branch instead.'
  23. });