Skip to content

Commit

Permalink
action.yml: support go1.16+ 'go install'-style installations
Browse files Browse the repository at this point in the history
  • Loading branch information
joelanford committed Jan 13, 2022
1 parent 0b38e06 commit 0641876
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-apidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
fetch-depth: 0
- uses: actions/setup-go@v1
with:
go-version: 1.15.x
go-version: 1.17.x
- uses: ./

6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ runs:
echo "*** Installing go-apidiff from source ***"
go install .
else
INSTALL_CMD="go install"
if [[ "$(go version | cut -d' ' -f3 | cut -d'.' -f2 | grep -o -E '[0-9]+' | head -1)" -lt "16" ]]; then
INSTALL_CMD="go get"
fi
DIR=$(mktemp -d)
(cd ${DIR} && GO111MODULE=on go get github.com/joelanford/go-apidiff@${{ inputs.version }}) && rmdir ${DIR}
(cd ${DIR} && GO111MODULE=on ${INSTALL_CMD} github.com/joelanford/go-apidiff@${{ inputs.version }}) && rmdir ${DIR}
fi
set -x
$(go env GOPATH)/bin/go-apidiff ${{ inputs.base-ref }} --compare-imports=${{ inputs.compare-imports }} --print-compatible=${{ inputs.print-compatible }} --repo-path=${{ inputs.repo-path }}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/joelanford/go-apidiff

go 1.15
go 1.17

require (
github.com/go-git/go-billy/v5 v5.0.0
Expand Down

0 comments on commit 0641876

Please sign in to comment.