DEV Community

Romain Lespinasse
Romain Lespinasse

Posted on • Edited on

Access commit info for your release and deployment workflows

My Workflow

Need to access git commit information in your workflow like this

- name: Get author and committer info from HEAD commit
  uses: rlespinasse/git-commit-data-action@v1.x

- name: Commit changed files
  uses: stefanzweifel/git-auto-commit-action@v4.1.6
  with:
    commit_message: "Automated commit message"
    commit_user_name: "${{ env.GIT_COMMIT_COMMITTER_NAME }}"
    commit_user_email: "${{ env.GIT_COMMIT_COMMITTER_EMAIL }}"
    commit_author: "${{ env.GIT_COMMIT_AUTHOR }}"
Enter fullscreen mode Exit fullscreen mode

Submission Category:

  • DIY Deployments

Yaml File or Link to Code

This action source code is available on https://github.com/rlespinasse/git-commit-data-action

- name: Expose git commit data
  uses: rlespinasse/git-commit-data-action@v1.x

- name: Print git commit data
  run: |
    echo "Get author info"
    echo " - ${{ env.GIT_COMMIT_AUTHOR }}"
    echo " - ${{ env.GIT_COMMIT_AUTHOR_NAME }}"
    echo " - ${{ env.GIT_COMMIT_AUTHOR_EMAIL }}"
    echo "Get committer info"
    echo " - ${{ env.GIT_COMMIT_COMMITTER }}"
    echo " - ${{ env.GIT_COMMIT_COMMITTER_NAME }}"
    echo " - ${{ env.GIT_COMMIT_COMMITTER_EMAIL }}"
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

Currently, use on my client project. If you use it, tell me.

GitHub logo rlespinasse / git-commit-data-action

Action to expose git commit info

Contributions welcome

Top comments (0)