Repository navigation
Conversation
…le workflow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two pull requests labeled
Stagingthat each add a migration both change thedefine(version: …)line indb/schema.rb, so rebuildingstagingdrops the second one even though the fix is obvious: keep the newest version. Handling it in the action keeps the fix in one place for every app.The action shouldn't assume a Rails app, so drivers are opt-in on the action and configurable: built-in drivers by name, custom ones with their own script, or both. The ability to specify custom drivers opens up experimentation without needing to modify the base action.
Changes
merge-driversinput onstaging-auto-merge, a YAML list. Each entry is the name of a built-in driver, or a mapping withname,files(a pattern or list of patterns) andscript. A built-in driver given as a mapping takesfilesto apply it to other files. The action rejects unknown built-in names, duplicate names, custom drivers that reuse a built-in name, and unknown keys. Default: none.railsschema, the only built-in driver so far (staging-auto-merge/drivers/railsschema). It sets thedefine(version: …)line to the newest of base, ours, and theirs, then runsgit merge-file, so a real schema conflict still fails with conflict markers and the pull request gets the usual comment.RUNNER_TEMPand registers every driver in.git/info/attributesand the checkout's git config, so nothing is committed tostaging.git merge --squashuses the drivers..github/workflows/maintain-staging.yml, a reusable workflow holding the trigger filter, one-at-a-time concurrency, the checkout with a deploy key, and the action call. Inputs:primary-branch(defaultmain),merge-drivers(defaultrailsschema; pass[]for none), andrunner(defaultubuntu-latest). Secret:deploy-key.yamlpackage to parse the input, which is whydist/index.jsgrew.Changelog
staging-auto-mergetakes amerge-driversinput for git merge drivers: built-in ones by name (railsschemaresolvesdb/schema.rbversion conflicts) and custom ones with their own script.maintain-staging.ymlreusable workflow rebuilds thestagingbranch withstaging-auto-merge, using therailsschemadriver by default.Tests
tests/merge-drivers.test.jsparses valid and invalid inputs, and runs realgit merge --squashmerges through drivers the action registers: the version-only conflict fails without a driver and merges withrailsschemawhichever side holds the newest version; a real schema conflict stops with markers around only that conflict; registering commits nothing; a custom driver runs alongsiderailsschema.npm testpasses (23 tests) andnpm run buildleavesdist/unchanged.githubgenerator.🤖 Generated with Claude Code