summary refs log tree commit diff stats
path: root/ci
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-04-23 01:05:23 -0700
committerGitHub <noreply@github.com>2021-04-23 10:05:23 +0200
commitdbb053492a3c64236f7e8f9358b9c7f297ba241a (patch)
tree6d5828d714f0a9580e32c2404d494c1b413ced1d /ci
parente4a3feeb92940a9b3c4ce88fc808a0cdff2e4e9c (diff)
downloadNim-dbb053492a3c64236f7e8f9358b9c7f297ba241a.tar.gz
followup #17561, skipping ci now implies green (#17813)
* followup #17561, skip ci now implies green; [skip ci]
* fixup [skip ci]
* fixup test without skip ci
* fixup [skip ci]
* fixup2 [skip ci]
* github actions now automatically supports [skip ci]
Diffstat (limited to 'ci')
-rw-r--r--ci/funs.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/ci/funs.sh b/ci/funs.sh
index de56ef152..7f82e1ca3 100644
--- a/ci/funs.sh
+++ b/ci/funs.sh
@@ -1,4 +1,5 @@
 # utilities used in CI pipelines to avoid duplication.
+# Avoid top-level statements.
 
 echo_run () {
   # echo's a command before running it, which helps understanding logs
@@ -6,3 +7,24 @@ echo_run () {
   echo "$@"
   "$@"
 }
+
+nimGetLastCommit() {
+  git log --no-merges -1 --pretty=format:"%s"
+}
+
+nimIsCiSkip(){
+  # D20210329T004830:here refs https://github.com/microsoft/azure-pipelines-agent/issues/2944
+  # `--no-merges` is needed to avoid merge commits which occur for PR's.
+  # $(Build.SourceVersionMessage) is not helpful
+  # nor is `github.event.head_commit.message` for github actions.
+  # Note: `[skip ci]` is now handled automatically for github actions, see https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
+  commitMsg=$(nimGetLastCommit)
+  echo commitMsg: "$commitMsg"
+  if [[ $commitMsg == *"[skip ci]"* ]]; then
+    echo "skipci: true"
+    return 0
+  else
+    echo "skipci: false"
+    return 1
+  fi
+}