diff --git a/.github/workflows/frozen-zone.yml b/.github/workflows/frozen-zone.yml new file mode 100644 index 000000000..ab100de81 --- /dev/null +++ b/.github/workflows/frozen-zone.yml @@ -0,0 +1,32 @@ +name: Prevent Merges During Frozen Zone Period + +on: + pull_request: + types: [opened, edited, reopened, synchronize] + pull_request_review: + types: [submitted] + +jobs: + freeze-check: + runs-on: ubuntu-latest + steps: + - name: Check for Frozen Zone + run: | + TARGET_BRANCH="${{ github.event.pull_request.base.ref }}" + FREEZE_START="2024-12-16T00:00:00Z" + FREEZE_END="2025-01-10T23:59:59Z" + CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + + echo "Target branch is $TARGET_BRANCH" + echo "Current time is $CURRENT_TIME" + + if [[ "$TARGET_BRANCH" == "main" ]]; then + if [[ "$CURRENT_TIME" > "$FREEZE_START" && "$CURRENT_TIME" < "$FREEZE_END" ]]; then + echo "🚫 We are in a freeze period. No merges allowed to 'main'!" + exit 1 + else + echo "✅ Not in a freeze period. Merging to 'main' is allowed." + fi + else + echo "✅ Target branch is not 'main'. Skipping freeze check." + fi \ No newline at end of file