Skip to content

Commit

Permalink
Add CI workflow for org management
Browse files Browse the repository at this point in the history
- runs flake8, black and unit tests
- fixed a black formatting issue
  • Loading branch information
stephanme committed Jan 23, 2025
1 parent 8c72983 commit f170f51
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/org-management-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Check Github Organization Settings PRs'
on:
pull_request:
paths:
- 'org/*.py'
- 'org/requirements*'
- 'org/pyproject.toml'
- '.github/workflows/org-management-ci.yml'
jobs:
org-config-generation-check:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: actions/checkout@v4
with:
path: community
- name: Run flake8 and unittests
run: |
python -m pip install --upgrade pip
pip install -r community/org/requirements.txt
pip install -r community/org/requirements-dev.txt
cd community/org
python -m flake8
python -m unittest discover -s .
24 changes: 13 additions & 11 deletions org/org_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,17 +444,19 @@ def _generate_wb_branch_protection(self, wg) -> Dict[str, Any]:
"required_pull_request_reviews": {
"dismiss_stale_reviews": True,
"require_code_owner_reviews": True,
"required_approving_review_count": 0
if len(
{
u["github"]
for a in wg["areas"]
if OrgGenerator._CF_ORG_PREFIX + repo in a["repositories"]
for u in a["approvers"]
}
)
< 4
else 1,
"required_approving_review_count": (
0
if len(
{
u["github"]
for a in wg["areas"]
if OrgGenerator._CF_ORG_PREFIX + repo in a["repositories"]
for u in a["approvers"]
}
)
< 4
else 1
),
"bypass_pull_request_allowances": {
"teams": [wg_bots] # wg bot team
+ [
Expand Down

0 comments on commit f170f51

Please sign in to comment.