Files
awesome-copilot/.github/workflows/check-pr-target.yml
Simon Kurtz 919fdb3f8e fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks (#1088)
* chore: publish from staged

* fix: pin GitHub Actions to immutable SHA hashes to prevent supply chain attacks

Co-authored-by: simonkurtz-MSFT <84809797+simonkurtz-MSFT@users.noreply.github.com>

* chore: publish from staged

* Clean plugins

* Clean plugins

* Clean plugins

* Fix gem-team plugin

* Reset README.plugins.md

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-03-23 10:37:40 +11:00

36 lines
1.1 KiB
YAML

name: Check PR Target Branch
on:
pull_request:
branches: [main]
types: [opened]
permissions:
pull-requests: write
jobs:
check-target:
runs-on: ubuntu-latest
steps:
- name: Reject PR targeting main
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
with:
script: |
const body = [
'⚠️ **This PR targets `main`, but PRs should target `staged`.**',
'',
'The `main` branch is auto-published from `staged` and should not receive direct PRs.',
'Please close this PR and re-open it against the `staged` branch.',
'',
'You can change the base branch using the **Edit** button at the top of this PR,',
'or run: `gh pr edit ${{ github.event.pull_request.number }} --base staged`'
].join('\n');
await github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: 'REQUEST_CHANGES',
body
});