Skip to content

Commit

Permalink
Create repo-pr-enforce-base-branch.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts authored Oct 17, 2024
1 parent fca8d61 commit 7ee8709
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/repo-pr-enforce-base-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Repo - Enforce dev as base branch
on:
pull_request:
branches: [ master ]
types: [ opened ]

jobs:
check_pr_target:
runs-on: ubuntu-latest
steps:
- name: Check if PR is from dev or hotfix
if: ${{ !(startsWith(github.event.pull_request.head.ref, 'hotfix/') || github.event.pull_request.head.ref == 'dev') }}
run: |
gh pr comment ${{ github.event.number }} --body "This PR targets the `master` branch but does not come from `dev` or a `hotfix/*` branch.\n\nAutomatically setting the base branch to `dev`."
gh pr edit ${{ github.event.number }} --base dev

0 comments on commit 7ee8709

Please sign in to comment.