File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : PR Base Branch Check
2+
3+ on :
4+ pull_request :
5+ types : [opened, edited, synchronize]
6+
7+ jobs :
8+ check-base-branch :
9+ name : Check PR Base Branch
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Check if PR targets main instead of develop
13+ if : github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref != 'develop'
14+ uses : actions/github-script@v7
15+ with :
16+ script : |
17+ const message = `⚠️ **WARNING: This PR targets \`main\` instead of \`develop\`**
18+
19+ This PR is targeting \`main\` which will trigger a production deployment when merged.
20+
21+ If this is a regular feature/fix PR, please change the base branch to \`develop\`.
22+ If this is intentional (e.g., hotfix), you can ignore this warning.
23+
24+ Current base: \`${context.payload.pull_request.base.ref}\`
25+ Recommended base: \`develop\``;
26+
27+ await github.rest.issues.createComment({
28+ owner: context.repo.owner,
29+ repo: context.repo.repo,
30+ issue_number: context.payload.pull_request.number,
31+ body: message
32+ });
33+
34+ core.warning('PR targets main branch - please verify this is intentional');
You can’t perform that action at this time.
0 commit comments