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

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.

  

5 Replies
Highlighted
Solution
GitHub Partner
Message 2 of 6

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

Copilot Lvl 2
Message 3 of 6

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 6

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 6

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 6

Re: Find what files changed in a pushed commit?

Hi @andyli ,

 

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

 

Thanks.