From a5699b620ad081b951a7dbb338621479c126378b Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Mon, 17 Feb 2020 13:13:32 +0200 Subject: [PATCH] CI: handle commit tag '%ci:no-build' This tag will force current workflow to exit with status 'passed'. --- .github/workflows/packages.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 4aced43a0..6a0a08c07 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -45,6 +45,12 @@ jobs: echo "Processing pull request #$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH"): ${BASE_COMMIT}..HEAD" CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r "${BASE_COMMIT}" "HEAD") fi + # Process tag '%ci:no-build' that may be added as line to commit message. + # Forces CI to cancel current build with status 'passed'. + if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 "HEAD"); then + echo "[!] Force exiting as tag '%ci:no-build' was applied to HEAD commit message." + exit 0 + fi # Build local Docker image if setup scripts were changed. # Useful for pull requests submitting changes for both build environment and packages. if grep -qP '^scripts/(Dockerfile|setup-ubuntu\.sh)$' <<< "$CHANGED_FILES"; then @@ -105,6 +111,10 @@ jobs: BINTRAY_GPG_SUBJECT: termux BINTRAY_GPG_PASSPHRASE: ${{ secrets.BINTRAY_GPG_PASSWORD }} run: | + if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 "HEAD"); then + echo "[!] Force exiting as tag '%ci:no-build' was applied to HEAD commit message." + exit 0 + fi for i in debs-*.tar; do tar xf $i done