Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 7

Find what files changed in a pushed commit?

Solved! Go to Solution.

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.

  

6 Replies
Highlighted
Solution
GitHub Partner
Message 2 of 7

Re: Find what files changed in a pushed commit?

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

Highlighted
Copilot Lvl 2
Message 3 of 7

Re: Find what files changed in a pushed commit?

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

Highlighted
Copilot Lvl 2
Message 4 of 7

Re: Find what files changed in a pushed commit?

"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.

Highlighted
Ground Controller Lvl 1
Message 5 of 7

Re: Find what files changed in a pushed commit?

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

Highlighted
GitHub Partner
Message 6 of 7

Re: Find what files changed in a pushed commit?

Hi @andyli ,

 

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

 

Thanks.

Highlighted
Ground Controller Lvl 2
Message 7 of 7

Re: Find what files changed in a pushed commit?

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.