Fix php-cs-fixer push trigger on 3.6 (keep pull_request_target behaviour unchanged) - #150
Merged
Merged
Conversation
|
There was a problem hiding this comment.
Pull request overview
Fixes PHP-CS-Fixer pushes by checking out the branch rather than a detached commit.
Changes:
- Uses push-event fallbacks for branch and repository.
- Preserves existing pull-request and fork behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Fix PHP-CS-Fixer silently discarding its own fixes on
pushto this maintenance branch, without changing any trigger.The bug
On a
pusheventgithub.event.pull_requestdoes not exist, so both inputs resolve to empty strings. The reusable workflow then falls back toref: github.sha— a bare commit, which always lands in detached HEAD.php-cs-fixerruns and computes real fixes, butgit-auto-commit-actioncannot push from detached HEAD (fatal: You are not currently on a branch), so every fix is silently thrown away.Same root cause as pimcore/data-quality-management-bundle#328; tracked in pimcore/service-operations#1071.
Why this shape, and not #328's exact change
#328 used
repository: ${{ github.repository }}, which is correct for push-only workflows. This branch also has apull_request_targettrigger, so hardcoding the base repo would make every fork PR check out a branch name that doesn't exist in the base repo — trading a silentpushfailure for a loud fork-PR failure.The
||fallback keeps both paths correct, and matches the idiom already used elsewhere:head_refrepositorypushgithub.ref_name(a branch → not detached)github.head_refgithub.head_refFork-PR behaviour is unchanged. On
pull_request_target,github.head_refis exactlygithub.event.pull_request.head.ref, and the||still resolves to the fork'sfull_name— so both inputs evaluate to the same values they do today. Only thepushpath changes.Triggers are deliberately left untouched: the
pull_requestvspull_request_targetdecision is still open in pimcore/product-management#1311, and this fix intentionally does not pre-empt it.Verification
pull_request_targetandpushtriggers intact;config_fileuntouched.pushrun'sgit-auto-commitstep should no longer report detached HEAD.Related: pimcore/service-operations#1071, pimcore/data-quality-management-bundle#328, pimcore/product-management#1311