Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(IDX): create workflow for repo policies #71

Merged
merged 10 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions .github/workflows/check_cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ jobs:
with:
repository: 'dfinity/public-workflows'

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
- name: Python Setup
uses: ./.github/workflows/python-setup

- name: Check Membership
id: check-membership
Expand Down Expand Up @@ -61,13 +56,8 @@ jobs:
with:
repository: 'dfinity/public-workflows'

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
- name: Python Setup
uses: ./.github/workflows/python-setup

- name: Check if accepting external contributions
id: accepts_external_contrib
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/check_cla_signed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ jobs:
uses: actions/checkout@v3
with:
repository: dfinity/public-workflows
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Dependencies
run: pip install -q -r requirements.txt
shell: bash
- name: Python Setup
uses: ./.github/workflows/python-setup
- name: Check CLA issue
run: |
export PYTHONPATH="$PWD/reusable_workflows/"
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/python-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Python Setup
description: Installs Python and necessary dependencies

runs:
using: composite
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
shell: bash
9 changes: 2 additions & 7 deletions .github/workflows/python_lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
- name: Python Setup
uses: ./.github/workflows/python-setup

- name: Run tests
run: pytest reusable_workflows/
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/repo_policies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Repository Policies

on:
workflow_call:

jobs:
check-bot-policies:
name: Check Bot Policies
runs-on: ubuntu-latest
# Dont run this workflow on merge queue
if: ${{ github.event_name != 'merge_group' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: dfinity/public-workflows

- name: Python Setup
uses: ./.github/workflows/python-setup

- name: Bot Checks
id: bot-checks
run: |
export PYTHONPATH="$PWD/reusable_workflows/"
python reusable_workflows/repo_policies/bot_checks/check_bot_approved_files.py
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_ORG: ${{ github.repository_owner }}
USER: ${{ github.event.pull_request.user.login }}
REPO: ${{ github.repository }}
MERGE_BASE_SHA: ${{ github.event.pull_request.base.sha }}
BRANCH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
12 changes: 12 additions & 0 deletions .github/workflows/repo_policies_ruleset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# triggered on all repositories via rulesets

name: Repo Policies Ruleset

on:
pull_request:
merge_group:

jobs:
call-repo-policies:
uses: dfinity/public-workflows/.github/workflows/repo_policies.yml@main
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def main() -> None:

else:
print(
f"{user} is not an approved bot. Letting CLA check handle contribution decision."
f"{user} is not a bot. Letting CLA check handle contribution decision."
)
block_pr = False

Expand Down
Loading