Skip to content

Add resolve-composer-lock-conflict action and workflow#10

Open
roborourke wants to merge 2 commits intomainfrom
add-resolve-composer-lock-conflict
Open

Add resolve-composer-lock-conflict action and workflow#10
roborourke wants to merge 2 commits intomainfrom
add-resolve-composer-lock-conflict

Conversation

@roborourke
Copy link
Copy Markdown

Summary

  • Adds .github/actions/resolve-composer-lock-conflict/action.yml — a composite action that detects and auto-resolves composer.lock content-hash conflicts in PRs by merging the base branch, verifying only the hash line differs, regenerating it via composer update --lock, and pushing a merge commit back to the PR branch
  • Adds .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 existing build-and-release-node pattern
  • Updates README.md with entries under both Available Actions and Complete Workflows

The action exits cleanly without touching the branch when:

  • composer.json is also conflicted (hash can't be correctly regenerated yet)
  • composer.lock has package-level conflicts (requires human review)
  • The PR is from a fork (push not possible with default pull_request token)

Note

After this PR merges, a follow-up should update the pinned SHA references in resolve-composer-lock-conflict.yml and the READMEs to the new release commit, following the same pattern as PR #8.

Test plan

  • In a plugin repo, create two branches from main that each add a different dev dependency to composer.json
  • Merge branch A to main, open a PR from branch B — GitHub shows a composer.lock content-hash conflict
  • Add a workflow calling resolve-composer-lock-conflict.yml on pull_request; push to branch B and confirm the workflow pushes a merge commit that makes the PR mergeable
  • Confirm the action exits cleanly (green, no push) when composer.json is also conflicted
  • Confirm the action exits cleanly when composer.lock has package-level differences

🤖 Generated with Claude Code

roborourke and others added 2 commits April 17, 2026 14:01
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>
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.

1 participant