diff --git a/.github/workflows/org-management-ci.yml b/.github/workflows/org-management-ci.yml new file mode 100644 index 000000000..46da00cfa --- /dev/null +++ b/.github/workflows/org-management-ci.yml @@ -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 . diff --git a/org/org_management.py b/org/org_management.py index d596dbc7d..fbc3a5fd4 100644 --- a/org/org_management.py +++ b/org/org_management.py @@ -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 + [