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 f71ae76
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/org-management-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Org Automation CI'
on:
pull_request:
paths:
- 'org/*.py'
- 'org/requirements*'
- 'org/pyproject.toml'
- '.github/workflows/org-management-ci.yml'
jobs:
org-automation-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: actions/checkout@v4
with:
path: community
- name: pip install
run: |
python -m pip install --upgrade pip
pip install -r community/org/requirements.txt
pip install -r community/org/requirements-dev.txt
- name: flake8 and black
run: |
cd community/org
python -m flake8
- name: unit tests
run: |
cd community/org
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 f71ae76

Please sign in to comment.