Is it possible to read the Git commit message within PSHs build/deploy hooks?
Joachim Beck
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?
0
Comments
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
When placing
git log -n 1 --pretty=%Bin 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.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
Please sign in to leave a comment.