Skip to content

Commit 49c1368

Browse files
authored
infra: code freeze (#164)
1 parent b0c8d72 commit 49c1368

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

.github/workflows/code-freeze.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Code Freeze
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
FROZEN: ${{ vars.FROZEN }}
14+
UNFROZEN_PREFIX: ${{ vars.UNFROZEN_PREFIX }}
15+
16+
jobs:
17+
check-pr-frozen-status:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Fetch PR data and check if merge allowed
21+
if: env.FROZEN == 'true'
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
PR_DATA=$(curl -s \
26+
-H "Authorization: Bearer $GITHUB_TOKEN" \
27+
-H "Accept: application/vnd.github.v3+json" \
28+
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
29+
BRANCH_NAME=$(echo $PR_DATA | jq .head.ref -r)
30+
PR_TITLE=$(echo $PR_DATA | jq .title -r)
31+
32+
echo $BRANCH_NAME
33+
echo $PR_TITLE
34+
35+
if [[ "$BRANCH_NAME" != $UNFROZEN_PREFIX* ]] &&
36+
[[ "$PR_TITLE" != fix:* && "$PR_TITLE" != *"[critical]"* ]]; then
37+
echo "Error: You can only merge from branches that start with '$UNFROZEN_PREFIX', or PRs titled with 'fix: ' and containing '[critical]'."
38+
exit 1
39+
fi

.github/workflows/twine-check.yml

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- main
77
- feature/**
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
twine-check:
1114
name: Check long description
@@ -20,6 +23,8 @@ jobs:
2023
run: python -m pip install --user --upgrade wheel
2124
- name: Install twine
2225
run: python -m pip install --user --upgrade twine
26+
- name: Install setuptools
27+
run: python -m pip install --user --upgrade setuptools
2328
- name: Build a binary wheel and a source tarball
2429
run: python setup.py sdist bdist_wheel
2530
- name: Check that long description will render correctly on PyPI.

0 commit comments

Comments
 (0)