Add resolve-composer-lock-conflict action and workflow#10
Open
roborourke wants to merge 2 commits intomainfrom
Open
Add resolve-composer-lock-conflict action and workflow#10roborourke wants to merge 2 commits intomainfrom
roborourke wants to merge 2 commits intomainfrom
Conversation
Adds a composite action and reusable workflow that automatically resolves composer.lock content-hash merge conflicts in pull requests. When two branches independently update composer.json, the content-hash field in composer.lock diverges; this action merges the base branch, verifies only the hash line is conflicted, regenerates it via composer update --lock, and pushes a merge commit back to the PR branch. Exits cleanly without touching the branch when composer.json is also conflicted, when there are package-level lock conflicts, or when the PR is from a fork. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The fork check was reading github.event.pull_request.head.repo.fork, which in a sync-branches workflow references the originally-labeled PR rather than the sync PR the action is actually operating on — leading to false positives. The fork case is better handled by letting the push fail loudly and documenting the limitation, which this commit does in the README alongside a full sync-branches integration example. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
.github/actions/resolve-composer-lock-conflict/action.yml— a composite action that detects and auto-resolvescomposer.lockcontent-hash conflicts in PRs by merging the base branch, verifying only the hash line differs, regenerating it viacomposer update --lock, and pushing a merge commit back to the PR branch.github/workflows/resolve-composer-lock-conflict.yml— a reusable workflow wrapper that sets up PHP (default 8.4, configurable) + Composer before calling the action, mirroring the existingbuild-and-release-nodepatternREADME.mdwith entries under both Available Actions and Complete WorkflowsThe action exits cleanly without touching the branch when:
composer.jsonis also conflicted (hash can't be correctly regenerated yet)composer.lockhas package-level conflicts (requires human review)pull_requesttoken)Note
After this PR merges, a follow-up should update the pinned SHA references in
resolve-composer-lock-conflict.ymland the READMEs to the new release commit, following the same pattern as PR #8.Test plan
mainthat each add a different dev dependency tocomposer.jsonmain, open a PR from branch B — GitHub shows acomposer.lockcontent-hash conflictresolve-composer-lock-conflict.ymlonpull_request; push to branch B and confirm the workflow pushes a merge commit that makes the PR mergeablecomposer.jsonis also conflictedcomposer.lockhas package-level differences🤖 Generated with Claude Code