I'm creating a pipeline
for manage Wordpress
themes building and I need to make sure that when a user merge the code on the master branch
the theme version is different from the one already present in master.
For example I have in master the 1.0.0
version, I want to make sure that after the merge the version is greather (or at least different ) from 1.0.0.
This is my stage:
check_theme_version_number:
stage: checks
script:
- git fetch
- lines=$(git diff origin/master origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME -- wp-content/themes/$THEME_NAME/style.css | grep Version | wc -l)
- if (($lines == 0)); then exit 1; fi
only:
- master
$THEME_NAME
is passed from Gitlab variables.
When I run this stage I get:
$ git fetch
From https://gitlab.com/xxxxx/xxxxx/xxxxx
* [new branch] develop -> origin/develop
$ lines=$(git diff origin/master origin/$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME -- wp-content/themes/$THEME_NAME/style.css | grep Version | wc -l)
fatal: bad revision 'origin/'
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1