Configure CI workflows to run once per PR push - #129
Conversation
- Remove copilot/** branch from push triggers in build-deploy.yml - Remove branch restriction from pull_request triggers in cloudflare-worker.yml - Remove branch restriction from pull_request triggers in devcontainer.yml This prevents duplicate workflow runs when pushing to PR branches. Before: push event + pull_request event = 2 runs After: pull_request event only = 1 run Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
Add detailed explanation of how workflows are configured to run only once per commit, avoiding duplicate runs on PR pushes. Document the benefits: cost savings, faster feedback, and resource efficiency. Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
LCOV of commit
|
There was a problem hiding this comment.
Pull request overview
This PR configures CI workflows to run only once per commit when pushing to pull request branches, eliminating duplicate workflow runs that occur when both push and pull_request triggers are configured for the same branches. The changes reduce GitHub Actions minutes usage and improve CI efficiency.
Key Changes:
- Removed
copilot/**from push triggers in build-deploy.yml to only run on direct pushes to main - Removed
branches: [main]specification from pull_request triggers in cloudflare-worker.yml and devcontainer.yml to allow PRs from any branch while maintaining single-run behavior - Added comprehensive documentation explaining the duplicate run problem and solution
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/build-deploy.yml | Removes copilot/** from push trigger branches to prevent duplicate runs on PR pushes |
| .github/workflows/cloudflare-worker.yml | Removes branches: [main] from pull_request trigger to allow PRs from any branch while avoiding duplicates |
| .github/workflows/devcontainer.yml | Removes branches: [main] from pull_request trigger to allow PRs from any branch while avoiding duplicates |
| docs/CICD.md | Updates documentation to reflect workflow changes and adds new section explaining duplicate CI run prevention, but contains outdated references to removed copilot branch triggers that need correction |
| - **Pull Requests**: Build, test, deploy preview to Cloudflare Pages | ||
| - **Push to `copilot/**`**: CI builds for Copilot branches | ||
| - **Pull Requests to `main`**: Build, test, deploy preview to Cloudflare Pages (runs once per push) | ||
| - **Manual**: Via workflow_dispatch in GitHub Actions UI |
There was a problem hiding this comment.
This line describes the behavior for "Push to copilot/**" branches, but this trigger has been removed from the workflow. This line should be deleted as it no longer applies to the updated workflow configuration.
There was a problem hiding this comment.
This was already fixed in commit 6ddd94e. The line about "Push to copilot/**" has been removed from the documentation.
| @@ -149,7 +150,6 @@ on: | |||
| - 'data/festivals.json' | |||
| - '.github/workflows/cloudflare-worker.yml' | |||
| pull_request: | |||
There was a problem hiding this comment.
This line in the code example shows branches: [main] under the pull_request trigger, but this has been removed from the actual cloudflare-worker.yml workflow file. The documentation should match the actual workflow configuration and omit this line.
There was a problem hiding this comment.
This was already fixed in commit 6ddd94e. The branches: [main] line under pull_request has been removed from the documentation to match the actual workflow file.
| | Workflow | File | Purpose | Triggers | | ||
| |----------|------|---------|----------| | ||
| | **Flutter App CI/CD** | `build-deploy.yml` | Build, test, and deploy Flutter app | Push to `main`, PRs, copilot branches | | ||
| | **Flutter App CI/CD** | `build-deploy.yml` | Build, test, and deploy Flutter app | Push to `main`, PRs to `main` | |
There was a problem hiding this comment.
This line still references "copilot branches" in the table, but the workflow changes remove support for copilot/** branches. The triggers column should be updated to reflect the new configuration: "Push to main, PRs to main".
There was a problem hiding this comment.
This was already fixed in commit 6ddd94e. The table now correctly shows "Push to main, PRs to main" without any reference to copilot branches.
| on: | ||
| push: | ||
| branches: [main, copilot/**] | ||
| branches: [main] |
There was a problem hiding this comment.
This code example still shows the old configuration with branches: [main, copilot/**]. It should be updated to match the actual workflow file which now only has branches: [main].
There was a problem hiding this comment.
This was already fixed in commit 6ddd94e. The code example now shows branches: [main] only (without copilot/**) to match the actual workflow file.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@copilot resolve review comments |
🚀 Cloudflare Pages PreviewYour preview deployment is ready! Preview URL: https://copilot-configure-ci-for-pr.staging-cambeerfestival.pages.dev This preview will be automatically updated when you push new commits to this PR. |
All review comments were already addressed in commit 6ddd94e. The documentation now correctly reflects the workflow configuration:
The workflows are now configured to run only once per PR push, preventing duplicate runs. |

GitHub Actions workflows were running twice on PR pushes: once for the
pushevent and once for thepull_requestevent, doubling CI minutes and cluttering the workflow history.Changes
Workflow trigger configuration:
build-deploy.yml: Removedcopilot/**from push triggers (now onlymain)cloudflare-worker.yml: Removed branch restriction frompull_requesttriggerdevcontainer.yml: Removed branch restriction frompull_requesttriggerResult:
pull_requestworkflow runpushworkflow runDocumentation:
docs/CICD.mdOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.