-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Problem
The current GitHub Actions workflow in .github/workflows/build_pat.yaml is configured to run on both push and pull_request events, which causes duplicate workflow runs when pushing to a branch that has an open pull request.
Current Behavior
When a developer pushes commits to a branch with an open PR, the workflow runs twice:
- Once for the
pushevent - Once for the
pull_requestevent
This results in:
- 8 duplicate jobs running simultaneously (4 OS matrix jobs × 2 triggers)
- Wasted CI resources and longer queue times
- Confusion about which run to monitor for PR status
- Potential rate limiting issues with external dependencies
Expected Behavior
The workflow should run only once per commit, with clear rules about when to use each trigger type.
Suggested Solution
Update the workflow triggers to use one of these patterns:
Option 1: PR-focused (Recommended)
on:
pull_request:
branches: ['*']
push:
branches: [develop, main] # Only run on main branches when no PR exists
tags: ['*']Option 2: Conditional execution
on:
pull_request:
branches: ['*']
push:
branches: ['*']
tags: ['*']
jobs:
pat_build:
# Skip push builds if there's an open PR for this branch
if: github.event_name \!= 'push' || github.event.pull_request == nullOption 3: Path-based optimization
Consider adding path filters to only run when relevant files change:
on:
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
push:
branches: [develop, main]
paths-ignore:
- '**.md'
- 'docs/**'Benefits
- 50% reduction in CI resource usage
- Faster feedback loops for developers
- Clearer CI status reporting
- Reduced load on external dependency servers
- Lower chance of hitting GitHub Actions usage limits
Files to Modify
.github/workflows/build_pat.yaml(lines 3-11)
Additional Considerations
- Ensure protected branch rules work with the chosen approach
- Test that release tags still trigger builds appropriately
- Verify status checks for PR merging continue to work
- Consider if any external integrations depend on specific trigger patterns
Metadata
Metadata
Assignees
Labels
No labels