mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-11-09 04:49:50 -10:00
"Classic - Python checks" now runs only when a PR or push changes Python files under `classic/`, not on every Python change in the repo. Resolves [SECRT-3239](https://linear.app/autogpt/issue/SECRT-3239) ### Why / What / How **Why:** every platform PR that touched a Python file ran Classic's isort, Black, Flake8 and pyright, against Classic code the PR never changed (#16268, for one). The workflow's `paths` listed `'**.py'`, which matches any Python file anywhere; it is left over from #8113, the 2024 re-org that moved Classic into `classic/`. Of the 35 `pull_request` runs between 09:20Z 29 Oct and 00:14Z 30 Oct that belong to an identifiable PR, 34 were on PRs that change nothing under `classic/`. **What:** `'**.py'` becomes `'classic/**.py'` in both the `push` and `pull_request` triggers. The other entries, including the `!classic/forge/tests/vcr_cassettes` exclusion, are unchanged. **How:** GitHub starts a run when any changed file matches a `paths` pattern, and `**` matches across directories, so `classic/**.py` matches Python files at any depth under `classic/` and nothing outside it. Every Python file in `classic/` today sits in the three directories the list already names; the narrowed line keeps a new directory there covered. ### Changes 🏗️ - `.github/workflows/classic-python-checks.yml`: `'**.py'` → `'classic/**.py'` in both triggers. This PR changes the workflow file itself, which is in its own path list, so Classic's checks run once on this PR. That run is expected. ### Verified Nothing else depends on the workflow running on platform PRs. The only required check on `dev` and `master` is `Check PR Status` (rulesets `dev-2` and `master-2`; no legacy branch protection), and `check_actions_status.py` waits only on check runs that exist on the sha, so a workflow that does not start leaves nothing for it to wait on. Nothing in `.github/` refers to this workflow by name, and it has no `merge_group` trigger, so the merge queue is unaffected. I could not run GitHub's path matcher locally: the proof that a platform-only PR no longer starts it is the first such PR after this merges. ### Agents and large language models used - Claude Code with Claude Opus 5.5 ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Required checks on `dev` and `master` read from the rulesets API - [x] `check_actions_status.py` and `.github/` searched for references to the workflow's name - [ ] A platform-only PR after merge shows no "Classic - Python checks" run #### For configuration changes: - [x] `.env.default` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (Claude Code) <[email protected]>
115 lines
3.2 KiB
YAML
115 lines
3.2 KiB
YAML
name: Classic - Python checks
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, dev, ci-test* ]
|
|
paths:
|
|
- '.github/workflows/classic-python-checks.yml'
|
|
- 'classic/original_autogpt/**'
|
|
- 'classic/forge/**'
|
|
- 'classic/direct_benchmark/**'
|
|
- 'classic/pyproject.toml'
|
|
- 'classic/poetry.lock'
|
|
- 'classic/**.py'
|
|
- '!classic/forge/tests/vcr_cassettes'
|
|
pull_request:
|
|
branches: [ master, dev, release-* ]
|
|
paths:
|
|
- '.github/workflows/classic-python-checks.yml'
|
|
- 'classic/original_autogpt/**'
|
|
- 'classic/forge/**'
|
|
- 'classic/direct_benchmark/**'
|
|
- 'classic/pyproject.toml'
|
|
- 'classic/poetry.lock'
|
|
- 'classic/**.py'
|
|
- '!classic/forge/tests/vcr_cassettes'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ format('classic-python-checks-ci-{0}', github.event_name == 'workflow_dispatch' && github.run_id || (github.head_ref && format('{0}-{1}', github.event_name, github.event.pull_request.number) || github.sha)) }}
|
|
cancel-in-progress: ${{ startsWith(github.event_name, 'pull_request') }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: classic
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
min-python-version: "3.12"
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ env.min-python-version }}
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: ${{ env.min-python-version }}
|
|
|
|
- name: Set up Python dependency cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: ~/.cache/pypoetry
|
|
key: ${{ runner.os }}-poetry-${{ hashFiles('classic/poetry.lock') }}
|
|
|
|
- name: Install Poetry
|
|
run: curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
- name: Install Python dependencies
|
|
run: poetry install
|
|
|
|
# Lint
|
|
|
|
- name: Lint (isort)
|
|
run: poetry run isort --check .
|
|
|
|
- name: Lint (Black)
|
|
if: success() || failure()
|
|
run: poetry run black --check .
|
|
|
|
- name: Lint (Flake8)
|
|
if: success() || failure()
|
|
run: poetry run flake8 .
|
|
|
|
types:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
min-python-version: "3.12"
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python ${{ env.min-python-version }}
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: ${{ env.min-python-version }}
|
|
|
|
- name: Set up Python dependency cache
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: ~/.cache/pypoetry
|
|
key: ${{ runner.os }}-poetry-${{ hashFiles('classic/poetry.lock') }}
|
|
|
|
- name: Install Poetry
|
|
run: curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
- name: Install Python dependencies
|
|
run: poetry install
|
|
|
|
# Typecheck
|
|
|
|
- name: Typecheck
|
|
if: success() || failure()
|
|
run: poetry run pyright
|