-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix formatting error and add endforce_flow workflow
- Loading branch information
Showing
3 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 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 |
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