Skip to content

Commit 389f742

Browse files
author
DvirDukhan
authored
early return from forked PR (#40)
1 parent 5796f22 commit 389f742

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.circleci/config.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,27 @@
22
#
33
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
44
#
5-
version: 2
5+
version: 2.1
6+
commands:
7+
early_return_for_forked_pull_requests:
8+
description: >-
9+
If this build is from a fork, stop executing the current job and return success.
10+
This is useful to avoid steps that will fail due to missing credentials.
11+
steps:
12+
- run:
13+
name: Early return if this build is from a forked PR
14+
command: |
15+
if [ -n "$CIRCLE_PR_NUMBER" ]; then
16+
echo "Nothing to do for forked PRs, so marking this step successful"
17+
circleci step halt
18+
fi
19+
620
jobs:
721
build:
822
docker:
923
- image: circleci/node:10.15
1024

1125
- image: redislabs/redisgraph:edge
12-
port: 6379:6379
1326

1427
working_directory: ~/repo
1528

@@ -33,6 +46,7 @@ jobs:
3346
# run tests!
3447
- run: sudo npm install -g istanbul codecov
3548
- run: istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec --exit
49+
- early_return_for_forked_pull_requests
3650
- run: codecov -t ${CODECOV_TOKEN}
3751

3852
docs:

0 commit comments

Comments
 (0)