Skip to content

Add dev branch, add container image tag main #3

Add dev branch, add container image tag main

Add dev branch, add container image tag main #3

name: Enforce PR policy
on:
pull_request:
types:
- opened
- edited
- synchronize
env:
GH_TOKEN: ${{ github.token }}
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check PR
run: |
PR_BASE=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json base -q ".base.ref")
PR_HEAD=$(gh pr.view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json head -q ".head.ref")
if [[ "$PR_BASE" == "main" ]] && ! [[ "$PR_HEAD" =~ ^dev$|^fix/ ]]; then
echo 'PRs to branch `main` can only come from branch `dev` or any branch prefixed with `fix/`'
exit 1
fi