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.