Skip to content

How to get all pushed commit information #25797

Answered by Yanjingzhu
nackdai asked this question in Actions
Discussion options

You must be logged in to vote

Hi @nackdai,
Sorry for the delay response.
In push event, before and after 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 :

on:
  push:
jobs:
   build: 
     runs-on: ubuntu-latest
     steps: 
      - uses: actions/checkout@v2
        with: 
          fetc…

Replies: 4 comments 4 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
3 replies
@matcaampos
Comment options

@batyrf
Comment options

@yolicap
Comment options

Answer selected
Comment options

You must be logged in to vote
1 reply
@batyrf
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback
7 participants