Skip to content

Merge pull request #38 from setheliot/dev #50

Merge pull request #38 from setheliot/dev

Merge pull request #38 from setheliot/dev #50

Workflow file for this run

# This GitHub action enforces that only merges from previous env will be accepted to next env
# for example: only merges from stage will be accepted into main (prod)
name: Enforce Flow
on:
push:
branches:
- main
- stage
pull_request:
branches:
- main
- stage
jobs:
enforce_flow:
name: Enforce Flow
runs-on: ubuntu-latest
steps:
# This is where we would add a check for merging into stage if we add an environment before stage
- name: No need to check if merging into stage
if: github.base_ref == 'stage'
run: exit 0
# If merging into main, ensure it is from stage
- name: Fail if PR is not from stage
if: github.base_ref == 'main' && github.head_ref != 'stage'
run: |
echo "Error: Pull request to main must come from the stage branch."
echo "This pull request is from ${{ github.head_ref }}"
exit 1
- name: Verify if tests passed on stage branch
run: |
echo "Checking if Tests passed on stage..."
if: ${{ github.event.pull_request.head.ref == 'stage' }}
continue-on-error: false