diff --git a/.github/workflows/ensure-main-from-dev.yaml b/.github/workflows/ensure-main-from-dev.yaml new file mode 100644 index 0000000..0c2ff23 --- /dev/null +++ b/.github/workflows/ensure-main-from-dev.yaml @@ -0,0 +1,21 @@ +name: Enforce PR Flow + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + check-source-branch: + runs-on: ubuntu-latest + + steps: + - name: Check PR flow + run: | + echo "PR: ${{ github.head_ref }} -> ${{ github.base_ref }}" + + if [[ "${{ github.base_ref }}" == "main" && "${{ github.head_ref }}" != "dev" ]]; then + echo "PRs to main must come from dev." + exit 1 + fi + + echo "PR flow is valid."