diff --git a/action.yml b/action.yml index abf14ff..ccfc2ba 100644 --- a/action.yml +++ b/action.yml @@ -136,7 +136,10 @@ runs: else echo "Skipping GoSec" fi - + - name: set-up go + uses: actions/setup-go@v3 + with: + go-version: 1.20.2 - name: "Run StaticCheck" shell: bash run: | @@ -144,18 +147,14 @@ runs: if [ "${{ inputs.run-staticcheck }}" == "true" ]; then cd /tmp - curl -fsSL https://api.github.com/repos/dominikh/go-tools/releases/latest \ - | grep -E "browser_download_url.*staticcheck_linux_amd64.tar.gz\"$" \ - | cut -d '"' -f 4 \ - | xargs -L 1 curl -fsSL -o /tmp/staticcheck_linux_amd64.tar.gz - tar -xvf /tmp/staticcheck_linux_amd64.tar.gz staticcheck/staticcheck - chmod +x ./staticcheck/staticcheck + go install honnef.co/go/tools/cmd/staticcheck@2023.1.2 + chmod +x /home/runner/go/bin/staticcheck CODACY_STATICCHECK_VERSION=$(curl -SL "https://artifacts.codacy.com/bin/codacy-staticcheck/latest" -o-) curl -fsSL "https://artifacts.codacy.com/bin/codacy-staticcheck/$CODACY_STATICCHECK_VERSION/codacy-staticcheck-$CODACY_STATICCHECK_VERSION" -o /tmp/codacy-staticcheck chmod +x /tmp/codacy-staticcheck cd - - find . -type f -name go.mod -exec bash -c 'cd $(dirname $1); cp $1 $1.codacy.bak; PKGS=$(go list ./...); /tmp/staticcheck/staticcheck -f json $PKGS; mv $1.codacy.bak $1' _ {} \; > /tmp/staticcheck-out.json + find . -type f -name go.mod -exec bash -c 'cd $(dirname $1); cp $1 $1.codacy.bak; PKGS=$(go list ./...); /home/runner/go/bin/staticcheck -f json $PKGS; mv $1.codacy.bak $1' _ {} \; > /tmp/staticcheck-out.json /tmp/codacy-staticcheck < /tmp/staticcheck-out.json > /tmp/codacy-out.json if [ ${{ inputs.upload }} = true ]; then curl -XPOST -L -H "$CURL_CODACY_AUTH_AUTHENTICATION" \