How to get all pushed commit information #25797
-
I would like to know how to get information of all commits which I pushed. For example, if I pushed 2 commits like below, can I get information of all pushed commits?
Especially, I would like to get changed files in all pushed commits. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
If you’re using Would setting actions/checkoutAction for checking out a repo. Contribute to actions/checkout development by creating an account on GitHub. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your response. Can we get how many commits we did? Just what I would like to know is modified files name which we push. I don’t mind to use Dockerfile or JavaScript for realizing it. |
Beta Was this translation helpful? Give feedback.
-
Hi @nackdai, To get the modified files accossiated with the push event, you could use Also, remember to set fetch-depth: 0 in
|
Beta Was this translation helpful? Give feedback.
-
I have some questions. |
Beta Was this translation helpful? Give feedback.
Hi @nackdai,
Sorry for the delay response.
In push event,
before
andafter
key are stand for the previous commit of this push operation and the last commit in this push operation. All the commits related to the push are included between these two commits.To get the modified files accossiated with the push event, you could use
git diff
command to get the file names.git diff --name-only ${{ github.event.before }} ${{ github.event.after }}
Also, remember to set fetch-depth: 0 in
checkout
action.Please see my example workflow yml :