Skip to content

Configure CI workflows to run once per PR push - #129

Merged
richardthe3rd merged 3 commits into
mainfrom
copilot/configure-ci-for-pr-push
Dec 11, 2025
Merged

Configure CI workflows to run once per PR push#129
richardthe3rd merged 3 commits into
mainfrom
copilot/configure-ci-for-pr-push

Conversation

Copilot AI commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

GitHub Actions workflows were running twice on PR pushes: once for the push event and once for the pull_request event, doubling CI minutes and cluttering the workflow history.

Changes

Workflow trigger configuration:

  • build-deploy.yml: Removed copilot/** from push triggers (now only main)
  • cloudflare-worker.yml: Removed branch restriction from pull_request trigger
  • devcontainer.yml: Removed branch restriction from pull_request trigger

Result:

  • PR pushes → single pull_request workflow run
  • Main pushes → single push workflow run

Documentation:

  • Added CI/CD workflow configuration details to docs/CICD.md
Original prompt

can we configure ci so only runs once on push to a pr


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- 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>
@richardthe3rd
richardthe3rd marked this pull request as ready for review December 11, 2025 21:22
Copilot AI review requested due to automatic review settings December 11, 2025 21:22
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>
@github-actions

github-actions Bot commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

LCOV of commit 6ddd94e during Flutter App CI/CD #656

Summary coverage rate:
  lines......: 62.5% (1598 of 2557 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread docs/CICD.md
- **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

Copilot AI Dec 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already fixed in commit 6ddd94e. The line about "Push to copilot/**" has been removed from the documentation.

Comment thread docs/CICD.md
@@ -149,7 +150,6 @@ on:
- 'data/festivals.json'
- '.github/workflows/cloudflare-worker.yml'
pull_request:

Copilot AI Dec 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/CICD.md
| 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` |

Copilot AI Dec 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already fixed in commit 6ddd94e. The table now correctly shows "Push to main, PRs to main" without any reference to copilot branches.

Comment thread docs/CICD.md
on:
push:
branches: [main, copilot/**]
branches: [main]

Copilot AI Dec 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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].

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already fixed in commit 6ddd94e. The code example now shows branches: [main] only (without copilot/**) to match the actual workflow file.

Copilot AI changed the title [WIP] Configure CI to run once on push to a PR Configure CI workflows to run once per PR push Dec 11, 2025
Copilot AI requested a review from richardthe3rd December 11, 2025 21:25
@codecov

codecov Bot commented Dec 11, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@richardthe3rd

Copy link
Copy Markdown
Owner

@copilot resolve review comments

@github-actions

Copy link
Copy Markdown
Contributor

📸 App Screenshots

Visual preview of the app after your changes:

Screen Preview (Mobile 390x844)
Drinks list Drinks list

Screenshots are automatically generated for PRs targeting main branch when app files change.

github-actions Bot added a commit that referenced this pull request Dec 11, 2025
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Cloudflare Pages Preview

Your 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.

Copilot AI commented Dec 11, 2025

Copy link
Copy Markdown
Contributor Author

@copilot resolve review comments

All review comments were already addressed in commit 6ddd94e. The documentation now correctly reflects the workflow configuration:

  • Removed all copilot branch references
  • Updated build-deploy.yml example to show only branches: [main]
  • Removed branches: [main] from cloudflare-worker.yml pull_request trigger
  • Added comprehensive explanation of single-run CI configuration

The workflows are now configured to run only once per PR push, preventing duplicate runs.

@richardthe3rd
richardthe3rd merged commit 976ff26 into main Dec 11, 2025
19 of 24 checks passed
@richardthe3rd
richardthe3rd deleted the copilot/configure-ci-for-pr-push branch December 11, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants