This folder contains Proof of Concept files to demonstrate GitHub Merge Queues.
.github/workflows/merge-queue-demo.yaml: A GitHub Actions workflow configured to run onpull_requestandmerge_groupevents.test.sh: A script that simulates test execution with various modes (pass,fail,flaky,sleep).version.txt: A simple text file used to demonstrate semantic conflicts.
- Action: Create a PR with no changes to the POC files (or trivial changes).
- Expectation: All checks pass. Add to merge queue. It merges successfully.
- Action: Modify
merge-queue-demo.yamlin your PR to run./scripts/test.sh fail. - Expectation: The PR check fails immediately. You cannot add it to the merge queue.
-
Action:
-
Modify
merge-queue-demo.yamlto make themerge-queue-exclusivejob fail:merge-queue-exclusive: if: github.event_name == 'merge_group' steps: - run: ./scripts/test.sh fail
-
-
Expectation:
- PR checks pass (because this job is skipped on
pull_request). - You add it to the merge queue.
- The job runs in the queue and fails.
- The PR is removed from the queue.
- PR checks pass (because this job is skipped on
-
Action:
-
Modify
merge-queue-demo.yamlto use theflakymode:flaky-test: steps: - run: ./scripts/test.sh flaky
-
-
Expectation:
- The test will fail ~50% of the time.
- Observe how the Merge Queue handles retries (if configured) or failures.
This scenario simulates two PRs that pass individually but fail when combined.
- Setup: Ensure
scripts/test.shis inmain. - PR A:
- Update
scripts/test.shto require an argument. - Change line 4 to:
MODE="${1:?Usage: test.sh <mode>}" - Update
merge-queue-demo.yamlin PR A to pass an argument (e.g.,./scripts/test.sh pass). - Result: PR A passes checks.
- Update
- PR B:
- Add a new step to
merge-queue-demo.yamlthat calls./scripts/test.shwithout arguments. - Result: PR B passes checks (because in PR B's context,
test.shis still the old version that defaults to "pass").
- Add a new step to
- Execution:
- Add PR A to the merge queue.
- Add PR B to the merge queue immediately after.
- PR A merges.
- PR B runs in the queue on top of PR A's changes.
- PR B's new step calls
test.sh(which is now the version from PR A). test.shfails because it requires an argument.- Result: PR B fails in the merge queue and is removed.
- PR A: Change
scripts/version.txtto1.1.0. - PR B: Change
scripts/version.txtto1.2.0. - Result: If git cannot auto-resolve, this is a standard merge conflict. If they touch different lines (e.g., appending to a log), both might merge, but a test checking for specific content would fail in the queue.