Skip to content

Commit 22a2e17

Browse files
author
Ivan Mirić
committed
Try to get the base commit without CIRCLE_COMPARE_URL
It's unreliable[1], and golangci-lint can produce false positives with this approach, though it might be a bug[2]. This --first-parent also might not work for all cases, though... [1]: https://discuss.circleci.com/t/circle-compare-url-is-empty/ [2]: golangci/golangci-lint#948 (comment)
1 parent 0cc901b commit 22a2e17

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ jobs:
5353
name: Run golangci-lint
5454
command: |
5555
export PATH="$GOPATH/bin:$PATH"
56-
basecommit=$(echo $CIRCLE_COMPARE_URL | sed -n 's:.*compare/\([^.]*\)\..*$:\1:p')
57-
echo -e "$CIRCLE_COMPARE_URL\nbasecommit=$basecommit"
58-
golangci-lint run --out-format=tab --new-from-rev "${basecommit-master}" ./...
56+
basecommit=$(git log --first-parent --pretty=format:'%H %D' | egrep '/(master|new-schedulers)' | head -1 | cut -d' ' -f1)
57+
echo "basecommit=$basecommit"
58+
golangci-lint run --out-format=tab --new-from-rev "$basecommit" ./...
5959
6060
6161
test:

0 commit comments

Comments
 (0)