Skip to main content

Is it possible to read the Git commit message within PSHs build/deploy hooks?

Comments

2 comments

  • Chad Carlson

    Hi @beck :wave:

    This isn’t something I’ve come across before, but I don’t believe that you’ll have access to commit messages in either the build or the deploy hooks. The filesystem isn’t even a repository at those points

        W: fatal: Not a git repository (or any parent up to mount point /)
        W: Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
    

    When placing git log -n 1 --pretty=%B in build or deploy hooks.

    One thing we’ve done internally is to name the branch with an identifier like skip-cache-flush. You won’t have access to that variable until post-build, but it at least gives you a way to do something selective like you’re describing.

    0
  • Joachim Beck

    Hey @chad-carlson ,
    thanks for your quick reply. I doubt the branch naming is an option for us.
    I’ll probably use a variable in the codebase then and hopefully don’t forget to change it in the next commit :slight_smile:

    0

Please sign in to leave a comment.