You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Is There a way to detect Revert action in commit history when running pipeline steps
the worst behave maybe by detecting commit message
I want to clear cache if there's revert action, there's a rare case when revert happen after success packages from composer install being cached but reverted then it use successful cached
Hi @xicond,
By 'revert action', are you referring to a git revert?
If so, I don't believe there is an automated way to detect this. A revert commit is just a normal commit for Git.
If you standardize your revert commit messages, you could write a script that gets the commit message of the commit that triggered the pipeline and looks for specific words or phrases in order to figure out if it is a revert commit; then use this script in your pipelines build.
You can use any of the following two commands in your Pipelines build to get the message of the commit that triggered the pipeline:
git log -n 1 --pretty=format:%s $BITBUCKET_COMMIT
git show -s --format=%B $BITBUCKET_COMMIT
You would need to make sure in this case that all users who work on this repo use the standard message for revert commits only and not for any other type of commits.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.