Is it possible to read the Git commit message within PSHs build/deploy hooks?
The information in this post is accurate as of the published date . Please make sure to check any linked documentation within the post for changes/updates.
Hi there,
my usecase is about optimising the cache invalidation in my app.
Not all releases need an overall cache flush. Skipping these scripts within the build/deploy hooks in ``.platform.app.yaml` depending on the Git commit message would solve this.
Example: Updating just a README file
git commit -m “TASK: Update README #skipcacheflush”
Anyone done that before?
-
Hi @beck
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 -
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 commit0
Please sign in to leave a comment.
Comments
2 comments