Skip to content
Commit ca5667d5 authored by Jaeden Amero's avatar Jaeden Amero
Browse files

gitlab: Only run gitlint on MRs



The gitlint job depends on environment variables, like
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME, in order to know how far back to
check git commit messages for style. These environment variables are not
available outside of a merge request context.

GitLab shows the following error when running gitlint, due to the
missing environment variable.

    $ gitlint --commits "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME..$CI_COMMIT_SHA"
    An error occurred while executing '/usr/bin/git rev-list origin/..c5c91523': b"fatal: ambiguous argument 'origin/..c5c91523': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'"

Change the gitlint job to run only in MR context to avoid the above
error and run gitlint only where it's useful to do so.

Signed-off-by: Jaeden Amero's avatarJaeden Amero <jaeden.amero@arm.com>
parent c5c91523
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment