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

meta(repo): Extra parameter validation for the production-build.yml workflow #6165

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
21 changes: 20 additions & 1 deletion .github/workflows/production-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Production Build
run-name: Production Build - [ ${{ github.ref_name || 'branch' }} ] - ${{ github.event.inputs.release_type || 'no_type_specified' }}
run-name: Production Build - ${{ github.event.inputs.release_type || 'no_type_specified' }}
on:
workflow_dispatch:
inputs:
Expand All @@ -23,6 +23,25 @@ env:
BUMP_COMMAND: pnpm run bump --release-as ${{ github.event.inputs.release_type || 'minor' }}

jobs:
validation:
runs-on: ubuntu-latest
steps:
- name: Check branch and release type
id: validate
run: |
BRANCH_NAME=$(echo "${{ github.ref_name }}" | awk -F'/' '{print $NF}')
echo "Branch: $BRANCH_NAME"

if [[ "$BRANCH_NAME" == "main" && "${{ github.event.inputs.release_type }}" == "patch" ]]; then
echo "Patch releases are not allowed on the main branch."
exit 1
fi

if [[ "$BRANCH_NAME" != "main" && "${{ github.event.inputs.release_type }}" != "patch" ]]; then
echo "Major and minor releases are only allowed on the main branch."
exit 1
fi

bump-version:
runs-on: ubuntu-latest
steps:
Expand Down
Loading