From c4d550a2fac937088da04c836b4032e5bbe44c73 Mon Sep 17 00:00:00 2001 From: Robert Rosca <robert.rosca@xfel.eu> Date: Mon, 8 Feb 2021 11:09:45 +0100 Subject: [PATCH] Check if MR commit SHA is set --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff6f8156a..d9ff880e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: rev: 3.8.4 hooks: - id: flake8 - entry: bash -c 'git diff $CI_MERGE_REQUEST_TARGET_BRANCH_SHA | flake8 --diff' -- + entry: bash -c 'if [ -z ${CI_MERGE_REQUEST_TARGET_BRANCH_SHA} ]; then (flake8 "$@"); else (git diff $CI_MERGE_REQUEST_TARGET_BRANCH_SHA | flake8 --diff); fi' -- - repo: https://github.com/myint/rstcheck rev: 3f92957478422df87bd730abde66f089cc1ee19b # commit where pre-commit support was added hooks: -- GitLab