This repository is set up to test GitHub's merge queue functionality, including SHA behavior, queue ordering, and handling of failed checks.
-
Enable GitHub Actions in your repository settings if not already enabled.
-
Set up branch protection and merge queue:
# Make sure you have GitHub CLI installed and authenticated ./setup-branch-protection.sh -
Create sample files for testing:
./create-sample-files.sh
The workflows include detailed SHA logging to help understand:
- How SHAs change when PRs enter the merge queue
- The difference between PR head SHA and merge queue SHA
- How merge commits are created in the queue
-
Create a new branch and make changes:
git checkout -b feature/test-1 echo "Test 1" > test1.txt git add test1.txt git commit -m "Add test1.txt" git push origin feature/test-1
-
Create a PR and observe:
- Initial PR SHA in the checks
- After approval, add to merge queue
- New merge queue SHA (different from PR SHA)
- Check results with the new SHA
-
Create multiple PRs quickly:
./create-multiple-prs.sh 3
-
Approve all PRs and add them to the merge queue simultaneously
-
Observe:
- How PRs are grouped in the queue
- SHA changes for each PR when entering the queue
- Order of processing
- How failure of one PR affects others
The repository includes intentionally flaky tests:
- flaky-test: 30% failure rate
- unstable-integration: 50% failure rate
- timing-sensitive: Fails during minutes ending in 3, 6, or 9
To test failure scenarios:
- Create a PR and add to merge queue
- If all checks pass, close and retry (statistically, you'll hit failures)
- Observe:
- How the merge queue handles failures
- Whether the PR is removed from queue
- If other PRs in queue are affected
-
Create PRs with different priorities:
# Create a large PR git checkout -b feature/large-change for i in {1..10}; do echo "Line $i" >> large-file.txt; done git add large-file.txt git commit -m "Large change" git push origin feature/large-change # Create a small urgent fix git checkout main git pull git checkout -b fix/urgent echo "urgent fix" > urgent.txt git add urgent.txt git commit -m "Urgent fix" git push origin fix/urgent
-
Add both to merge queue and observe processing order
Each workflow run logs detailed SHA information:
- Check the "Show SHA information" step in any workflow run
- Compare PR SHA vs merge queue SHA
- Track how SHAs change through the process
The workflows differentiate between:
pull_requestevents (normal PR checks)merge_groupevents (merge queue checks)
Look for "Event Name" in the logs to understand the context.
Use GitHub's merge queue UI:
- Go to the Pull Requests tab
- Click on "Merge Queue" to see current queue status
- Observe position, estimated time, and check status
- Cause: Different SHA or merge conflicts
- Solution: Check SHA differences in logs, ensure base branch is up-to-date
- Cause: Consistently failing flaky tests
- Solution: Re-run failed checks or temporarily disable flaky tests
- Cause: Conservative queue settings or many failing checks
- Solution: Adjust
max_entries_to_mergeandmin_entries_to_mergein setup script
- High traffic: Use
create-multiple-prs.shwith higher numbers - Complex conflicts: Create PRs that modify same files
- Long-running tests: Modify workflows to add delays
Track metrics:
- Time from PR approval to merge
- Queue failure rate
- Impact of grouping strategies
To remove test branches after testing:
# List all test branches
git branch -r | grep 'origin/feature/test-\|origin/fix/'
# Delete remote branches
git push origin --delete feature/test-1 feature/test-2 # etc