Skip to content

Check pushed file changes with git diff-tree in GitHub Actions #25950

Answered by weide-zhou
hankehly asked this question in Actions
Discussion options

You must be logged in to vote

Please remove/reset the ‘fetch-depth’ for ‘actions/checkout’, output works fine then for the command ‘git diff-tree’.

You can get/pipe the changed files via command below:

- name: get changed files
        id: getfile
        run: |
          echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)"
  - name: echo output
    run: |
      echo ${{ steps.getfile.outputs.files }}

Replies: 10 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
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
0 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
0 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
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment