Skip to content

I want to automate code formatting with php-cs-fixer using Github Actions #24629

Discussion options

You must be logged in to vote
gensui0530:

Is it possible to achieve this with these?

If you can apply your tool to a list of files, yes. Once you have the two commits you want to compare you can use git diff --name-only to get a list of files that changed between them.

The most effort will probably be to get the right commit IDs to compare.

For a push event it’s fairly easy at a glance with the before and after fields, except in case of a force-push (in that case the before commit won’t be part of the branch history any more).

For a pull_request you need to decide what you want to compare: There’s the base branch (probably a given), but do you want to compare to the head branch (that’s supposed to get merged) or …

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment