Find what files changed in a pushed commit?

I want to get the file names or relative path of the changed files triggered by push. I am already filtering the action with the on.push.paths functionality in the workflow. I need to find what specific files changed as I am going to run a process on them and would like to only run it on the changed files.

  

Please use below command to get the changed files in the push commit, please refer to this link for more details.

git diff-tree --no-commit-id --name-only -r ${{ github.sha }}

changedfiles.png

5 Likes

Thanks that worked great. Now I just need to figure out how to pipe that into the next step. 

"Thanks that worked great. Now I just need to figure out how to pipe that into the next step. "

I’m working on the same thing.  Please post if you find a solution and I’ll do the same.

1 Like

What if I pushed more than one commits at once? What would ${{ github.sha }} contain?

Hi @andyli ,

For multi commits, you can find my anwser in this ticket.

Thanks.

Monitor github file changes on commits, PRs, etc (on any repo) and get a notification using webhooks, look for patterns, review diffs, take actions, etc. 

Source code is available here: https://github.com/DevScoreInc/samples/tree/master/github-file-monitor

Demo is here: https://youtu.be/6HgxIkT8EQ4

Free to deploy and use. 

1 Like