phabricator-refresh: add a magic value to skip it in the CI
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 03 Feb 2022 06:49:48 +0100
changeset 48711 fba2d7fab11e
parent 48710 bf3da4e02087
child 48712 937998e43e93
phabricator-refresh: add a magic value to skip it in the CI When maintaining (light) fork, it is useful to be able to disable this. Differential Revision: https://phab.mercurial-scm.org/D12133
contrib/heptapod-ci.yml
contrib/phab-refresh-stack.sh
--- a/contrib/heptapod-ci.yml	Thu Jan 27 20:04:56 2022 +0300
+++ b/contrib/heptapod-ci.yml	Thu Feb 03 06:49:48 2022 +0100
@@ -56,6 +56,11 @@
 
 phabricator-refresh:
     stage: phabricator
+    rules:
+      - if: '"$PHABRICATOR_TOKEN" != "NO-PHAB"'
+        when: on_success
+      - if: '"$PHABRICATOR_TOKEN" == "NO-PHAB"'
+        when: never
     variables:
       DEFAULT_COMMENT: ":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)"
       STABLE_COMMENT: ":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)\n⚠ This patch is intended for stable ⚠\n{image https://media.giphy.com/media/nYI8SmmChYXK0/source.gif}"
--- a/contrib/phab-refresh-stack.sh	Thu Jan 27 20:04:56 2022 +0300
+++ b/contrib/phab-refresh-stack.sh	Thu Feb 03 06:49:48 2022 +0100
@@ -1,6 +1,11 @@
 #!/bin/bash
 set -eu
 
+if [[ "$PHABRICATOR_TOKEN" == "NO-PHAB" ]]; then
+    echo 'Skipping Phabricator Step' >&2
+    exit 0
+fi
+
 revision_in_stack=`hg log \
     --rev '.#stack and ::. and topic()' \
     -T '\nONE-REV\n' \
@@ -27,6 +32,7 @@
 
 if [[ "$PHABRICATOR_TOKEN" == "" ]]; then
     echo 'missing $PHABRICATOR_TOKEN variable' >&2
+    echo '(use PHABRICATOR_TOKEN="NO-PHAB" to disable this step)' >&2
     exit 2
 fi