Conversation
Greptile SummaryThis PR adds Key points:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Workflow Triggered] --> B{Event Type?}
B -- "push to main/dev" --> C["event_name != 'pull_request' → TRUE\ncheck-changes runs"]
B -- "pull_request event" --> D{PR is draft?}
D -- "draft == true" --> E["Condition FALSE\ncheck-changes SKIPPED"]
D -- "draft == false" --> F["Condition TRUE\ncheck-changes RUNS"]
E --> G["ros, python, navigation\nresult = skipped"]
E --> H["ros-python, dev, ros-dev\nif: always() → dispatched\nshould-run = false inside template"]
E --> I["inspect-needs\nif: always() → runs on runner"]
E --> J["run-tests, run-mypy\nneeds.check-changes.result == 'success' → FALSE\nresult = skipped"]
E --> K["ci-complete\nif: always() → runs on runner\nNo failures → ✅ passes"]
F --> L["Normal CI pipeline\nAll jobs evaluate normally"]
C --> L
|
.github/workflows/docker.yml
Outdated
|
|
||
| jobs: | ||
| check-changes: | ||
| if: github.event.pull_request.draft == false |
There was a problem hiding this comment.
if condition skips check-changes on push events to main/dev
docker.yml is also triggered by push events on main and dev branches (lines 3–8). For those push-triggered runs, github.event.pull_request does not exist in the event payload, so github.event.pull_request.draft resolves to '' (empty string) in GitHub Actions expression context.
GitHub Actions coerces '' == false as 0 == 0 → true, so the condition does evaluate to true for push events and the job runs correctly.
However, this coercion behavior is non-obvious and relies on undocumented type-casting semantics. A more robust and explicit form would be:
| if: github.event.pull_request.draft == false | |
| if: github.event_name == 'push' || github.event.pull_request.draft == false |
This makes the intent unambiguous and guards against any future changes in GitHub Actions expression evaluation.
Added draft check to entry-point jobs (check-changes in docker.yml, pre-commit in code-cleanup.yml). All downstream jobs depend on these via `needs`, so everything skips when a PR is draft. Uses `github.event_name != 'pull_request' || github.event.pull_request.draft == false` to ensure push events (merges to main/dev) still trigger CI — only pull_request events check draft status.
7b57ba9 to
b317bfb
Compare
|
@greptile |
|
|
||
| jobs: | ||
| pre-commit: | ||
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false |
There was a problem hiding this comment.
Dead condition in event_name guard
code-cleanup.yml only has a pull_request trigger (line 3) — there is no push trigger in this file. This means github.event_name will always be 'pull_request' when this workflow runs, so the github.event_name != 'pull_request' branch is always false and never short-circuits the condition. The effective logic here is simply github.event.pull_request.draft == false.
This guard is necessary and correct in docker.yml (which has both push and pull_request triggers), but it is redundant in this file. Using the same pattern in both files provides consistency, which is a reasonable motivation — but it's worth noting the asymmetry so future readers aren't confused about why the extra guard is needed.
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false | |
| if: github.event.pull_request.draft == false |
Problem
PR #1398 claimed to skip CI on draft PRs but only added
ready_for_reviewto the trigger types. Thesynchronizeevent still fires on every push regardless of draft status, wasting self-hosted runner time.Fix
Added
if: github.event.pull_request.draft == falseto:check-changesjob indocker.ymlpre-commitjob incode-cleanup.ymlThese are the entry-point jobs — all downstream jobs depend on them via
needs, so everything skips when a PR is draft.2-line change
Contributor License Agreement