Skip to content

Commit

Permalink
infra: no unfrozen prefix when variable is not present (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajberdy authored Dec 6, 2023
1 parent 2bb1e74 commit dedfb72
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/code-freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,18 @@ jobs:
echo $BRANCH_NAME
echo $PR_TITLE
if [[ "$BRANCH_NAME" != $UNFROZEN_PREFIX* ]] &&
[[ "$PR_TITLE" != fix:* && "$PR_TITLE" != *"[critical]"* ]]; then
echo "Error: You can only merge from branches that start with '$UNFROZEN_PREFIX', or PRs titled with 'fix: ' and containing '[critical]'."
exit 1
# if it's not a critical fix
if ! [[ "$PR_TITLE" == fix\(critical\):* ]]; then
# and there's an unfrozen prefix
if ! [[ -z $UNFROZEN_PREFIX ]]; then
# check if the branch matches unfrozen prefix
if [[ "$BRANCH_NAME" != $UNFROZEN_PREFIX* ]]; then
echo "Error: You can only merge from branches that start with '$UNFROZEN_PREFIX', or PRs titled with prefix 'fix(critical): '."
exit 1
fi
# repo is fully frozen
else
echo "Error: You can only merge PRs titled with prefix 'fix(critical): '."
exit 1
fi
fi

0 comments on commit dedfb72

Please sign in to comment.