Skip to content

Commit 3dec42d

Browse files
authored
Add GitHub action to disallow direct PRs to main (ESCOMP#285)
Originator(s): jimmielin Description (include issue title and the keyword ['closes', 'fixes', 'resolves'] and issue number): - adds a GitHub action to disallow branches other than `development` to have a PR to `main` List all namelist files that were added or changed: N/A List all files eliminated and why: N/A List all files added and what they do: ``` .github/workflows/no-direct-pr-to-main.yaml - add GitHub workflow ``` List all existing files that have been modified, and describe the changes: (Helpful git command: `git diff --name-status development...<your_branch_name>`) N/A List all automated tests that failed, as well as an explanation for why they weren't fixed: N/A Is this an answer-changing PR? If so, is it a new physics package, algorithm change, tuning change, etc? N/A - GitHub actions only, no code If yes to the above question, describe how this code was validated with the new/modified features:
1 parent bddf85a commit 3dec42d

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: PRs to main must be from development branch
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
- edited
9+
branches:
10+
- main
11+
jobs:
12+
check-branches:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check branches
16+
run: |
17+
if [ ${{ github.head_ref }} != "development" ]; then
18+
echo "Merge requests to main branch are only allowed from the development branch."
19+
exit 1
20+
fi

0 commit comments

Comments
 (0)