Skip to content

Commit 44b16c3

Browse files
authored
Update config.yml
1 parent 27ac1dd commit 44b16c3

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.circleci/config.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
# Check https://circleci.com/docs/2.0/language-java/ for more details
44
#
55
version: 2
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:
@@ -38,8 +52,10 @@ jobs:
3852
# run tests!
3953
- run: mvn integration-test
4054
- run: mvn cobertura:cobertura
41-
- run: bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
4255

56+
- early_return_for_forked_pull_requests
57+
58+
- run: bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}
4359
- run: mvn -s .circleci.settings.xml -DskipTests deploy
4460

4561
workflows:

0 commit comments

Comments
 (0)