Skip to content

Commit d44a706

Browse files
jneiramergify[bot]
andauthored
Make circleci honour [skip ci] wherever is placed in the pr info (title, description) (#2289)
* Dirty hack to honour [circle ci] * Show vars name in echos * Add comment about the hack Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent f156858 commit d44a706

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

.circleci/config.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,50 @@ defaults: &defaults
1616
keys:
1717
- v4-stack-cache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "resolver.txt" }}
1818

19+
# Looking for the string [skip ci] in all the json returned by https://docs.github.com/en/rest/reference/pulls#get-a-pull-request
20+
- run:
21+
name: Skip ci setup
22+
command: |
23+
set +e
24+
echo "CIRCLE_PULL_REQUEST: $CIRCLE_PULL_REQUEST"
25+
if [[ ! -z $CIRCLE_PULL_REQUEST ]]; then
26+
PULL_REQUEST_URL=${CIRCLE_PULL_REQUEST/github.com/api.github.com/repos}
27+
PULL_REQUEST_URL=${PULL_REQUEST_URL/pull/pulls}
28+
echo "PULL_REQUEST_URL: $PULL_REQUEST_URL"
29+
SKIP_CI=$(curl $PULL_REQUEST_URL | grep -o "\\[skip ci\\]")
30+
echo "SKIP_CI: $SKIP_CI"
31+
fi
32+
echo "export SKIP_CI=$SKIP_CI" >> $BASH_ENV
33+
1934
- run:
2035
name: Stack upgrade
21-
command: stack upgrade
36+
command: |
37+
if [[ -z "$SKIP_CI" ]]; then
38+
stack upgrade
39+
fi
2240
2341
- run:
2442
name: Stack setup
25-
command: stack -j2 --stack-yaml=${STACK_FILE} setup
43+
command: |
44+
if [[ -z "$SKIP_CI" ]]; then
45+
stack -j2 --stack-yaml=${STACK_FILE} setup
46+
fi
2647
2748
- run:
2849
name: Build (we need the exe for tests)
2950
# need j1, else ghc-lib-parser triggers OOM
30-
command: stack -j1 --stack-yaml=${STACK_FILE} install --no-terminal
51+
command: |
52+
if [[ -z "$SKIP_CI" ]]; then
53+
stack -j1 --stack-yaml=${STACK_FILE} install --no-terminal
54+
fi
3155
no_output_timeout: 30m
3256

3357
- run:
3458
name: Build Testsuite without running it
35-
command: stack -j1 --stack-yaml=${STACK_FILE} build --test --no-run-tests --no-terminal
59+
command: |
60+
if [[ -z "$SKIP_CI" ]]; then
61+
stack -j1 --stack-yaml=${STACK_FILE} build --test --no-run-tests --no-terminal
62+
fi
3663
no_output_timeout: 30m
3764

3865
- store_artifacts:

0 commit comments

Comments
 (0)