Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(automation): Add Check to ensure only next moves code to prod #5676

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/on-pr-change.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check pull request source branch
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- edited
jobs:
check-branches:
runs-on: ubuntu-latest
steps:
- name: Check branches
env:
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
if [[ "${{ env.HEAD_REF }}" =~ [^a-zA-Z0-9-_] ]]; then
echo "head_ref has invalid characters."
exit 1
fi
if [[ "${{ env.BASE_REF }}" =~ [^a-zA-Z0-9-_] ]]; then
echo "base_ref has invalid characters."
exit 1
fi
if [ ${{ env.HEAD_REF }} != "next" ] && [ ${{ env.BASE_REF }} == "prod" ]; then
echo "Merge requests to prod branch are only allowed from next branch."
exit 1
fi
Fixed Show fixed Hide fixed
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
workflow_dispatch:

jobs:

dependency-review:
rifont marked this conversation as resolved.
Show resolved Hide resolved
name: Dependency review
runs-on: ubuntu-latest
Expand Down Expand Up @@ -174,7 +175,7 @@ jobs:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-project

- name: Run Lint, Build, Test
uses: mansagroup/nrwl-nx-action@v3
with:
Expand Down
Loading