Skip to content

Commit 045ecf1

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 045ecf1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

.circleci/config.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ 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+
golangci-lint run --out-format=tab --new-from-rev "${basecommit}" ./...
5958
6059
6160
test:

0 commit comments

Comments
 (0)