File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Enforce Release Freeze
2+
3+ on :
4+ pull_request :
5+ branches : [main]
6+
7+ jobs :
8+ freeze-check :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Check out repository
13+ uses : actions/checkout@v4
14+
15+ - name : Set up jq
16+ run : sudo apt-get update && sudo apt-get install -y jq
17+
18+ - name : Enforce branch freeze logic
19+ shell : bash
20+ env :
21+ # GITHUB_HEAD_REF: Source branch name for PRs
22+ PR_BRANCH : ${{ github.head_ref }}
23+ run : |
24+ CONFIG_FILE="development/.release-config.json"
25+
26+ if [[ ! -f "$CONFIG_FILE" ]]; then
27+ echo "✅ No release config file - passing check."
28+ exit 0
29+ fi
30+
31+ FREEZE=$(jq '.freeze' "$CONFIG_FILE")
32+
33+ if [[ "$FREEZE" != "true" ]]; then
34+ echo "✅ Freeze is off - passing check."
35+ exit 0
36+ fi
37+
38+ ALLOW_LIST=( $(jq -r '.allow_list[]' "$CONFIG_FILE") )
39+
40+ BRANCH="$PR_BRANCH"
41+ ALLOWED=0
42+
43+ # Check for exact branch name in allow_list
44+ for ENTRY in $(jq -r '.allow_list[]' "$CONFIG_FILE"); do
45+ if [[ "$BRANCH" == "$ENTRY" ]]; then
46+ ALLOWED=1
47+ break
48+ fi
49+ done
50+
51+ if [[ "$ALLOWED" == "1" ]]; then
52+ echo "✅ Branch '$BRANCH' is in allow_list. Passing check."
53+ exit 0
54+ else
55+ echo "❌ Release freeze is ACTIVE!"
56+ REASON=$(jq -r '.reason' "$CONFIG_FILE")
57+ echo "Reason: $REASON"
58+ echo "Branch '$BRANCH' is NOT permitted to merge under current freeze rules."
59+ exit 1
60+ fi
Original file line number Diff line number Diff line change 1+ {
2+ "freeze" : false ,
3+ "reason" : " Release description" ,
4+ "allow_list" : []
5+ }
You can’t perform that action at this time.
0 commit comments