update README #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |