morphy2k / revive-action Goto Github PK
View Code? Open in Web Editor NEWLint your Go code with Revive
License: MIT License
Lint your Go code with Revive
License: MIT License
Is it possible to pass a custom subpath in my repo to the Revive Action?
I run this via the revive
CLI like so:
$ revive ./foo/bar/...
I haven't found a way to either pass this path to the Revive Action or as a fallback put it in the config.toml.
Due to an issue with Revive v1.3.5 in connection with go install
, the build process of v2.5.5 fails.
Cool project!
We've started using revive-action
at Pyroscope and one of the issues we've ran into is that github has a limit of 10 annotations max.
This means for most of our PRs it's going to show annotations for lines that were not changed in the PR, and so it's less useful.
It would be cool if revive-action
could remove the lines that are not relevant for the current PR, this way getting around this github limitation.
Thanks!
Hello,
With this config :
name: Lint
on:
- pull_request
jobs:
lint:
name: check
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run Revive Action by pulling pre-built image
uses: docker://morphy/revive-action:v1.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
I got this ouptut :
Run docker://morphy/revive-action:v1.4.0
/usr/bin/docker run --name morphyreviveactionv140_1cc8eb --label 5588e4 --workdir /github/workspace --rm -e GITHUB_TOKEN -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/lerobot/lerobot":"/github/workspace" morphy/revive-action:v1.4.0
Successful run with 1 failures (1 warnings, 0 errors)
No annotation in my Pull Request, and linter result is green.
i. create a PR to a repo that configured revive action
ii. it will be failed as unexpected
the log is as below:
Run docker://morphy/revive-action:v1
/usr/bin/docker run --name morphyreviveactionv1_7788ea --label 87c201 --workdir /github/workspace --rm -e GITHUB_TOKEN -e INPUT_CONFIG -e INPUT_PATH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/ncm-helper/ncm-helper":"/github/workspace" morphy/revive-action:v1
Error while creating check-run: POST https://api.github.com/repos/greenhat616/ncm-helper/check-runs: 403 Resource not accessible by integration []
the workflow file:
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
name: Go
jobs:
test:
name: Test
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go module
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependences
run: make dep
- name: Check code issues by vet
run: make vet
- name: Test
run: make test
- name: Test Coverage
run: make test-coverage
- name: Post coverage data to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
- name: Clean Make
run: make clean
lint:
name: Lint
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Lint Go code with revive
uses: docker://morphy/revive-action:v1
with:
config: ./revive.toml
path: ./...
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build
strategy:
matrix:
go-version: [1.14.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Cache Go module
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build
run: make build
We are trying to add this action as part of our CI process and its succeeds even though there are errors.
GHA yml file...
name: Go Code Quality Checks
on:
workflow_call:
inputs:
SHA:
description: "full sha to build"
type: string
required: true
jobs:
Checks:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with:
ref: ${{ inputs.sha }}
- name: Run Revive Action by pulling pre-built image
uses: docker://morphy/revive-action:v2
with:
config: revive.toml
The job succeeds with this message...
Successful run with 95 failures (0 warnings, 95 errors)
It looks like this action does not pass args like the custom config file to the container. According to https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action#creating-an-action-metadata-file you need to add it as args in the docker build so the environment variables are available inside the docker container
Hello ๐,
Looks like something external changed in the last day or so.
Docker is failing to start due to go get
not being able to find some packages.
Any Thoughts?
Here are the logs from my workflow if that helps:
/usr/bin/docker build -t 671ee6:650638fa081e4db784948ac223705bb3 "/home/runner/work/_actions/morphy2k/revive-action/v1.3.0"
Sending build context to Docker daemon 57.86kB
Step 1/12 : FROM golang:1.13
---> ed081345a3da
Step 2/12 : LABEL repository="https://github.com/morphy2k/revive-action"
---> Using cache
---> 0f20a6f59138
Step 3/12 : LABEL homepage="https://github.com/morphy2k/revive-action"
---> Using cache
---> c5b1205143f6
Step 4/12 : LABEL maintainer="Markus Wiegand <[email protected]>"
---> Using cache
---> d52ce952324d
Step 5/12 : LABEL com.github.actions.name="Revive Action"
---> Using cache
---> b098a554cf32
Step 6/12 : LABEL com.github.actions.description="Lint your Go code with Revive"
---> Using cache
---> 88308ce13a46
Step 7/12 : LABEL com.github.actions.icon="code"
---> Using cache
---> c65aed5c5d95
Step 8/12 : LABEL com.github.actions.color="blue"
---> Using cache
---> 712560e3fb08
Step 9/12 : RUN go get -v github.com/mgechev/revive
---> Using cache
---> 7a0f7e4b0dcc
Step 10/12 : RUN go get -v github.com/morphy2k/revive-action
---> Running in c67c1b254981
github.com/morphy2k/revive-action (download)
github.com/google/go-github (download)
package github.com/google/go-github/v28/github: cannot find package "github.com/google/go-github/v28/github" in any of:
/usr/local/go/src/github.com/google/go-github/v28/github (from $GOROOT)
/go/src/github.com/google/go-github/v28/github (from $GOPATH)
get "golang.org/x/oauth2": found meta tag get.metaImport{Prefix:"golang.org/x/oauth2", VCS:"git", RepoRoot:"https://go.googlesource.com/oauth2"} at //golang.org/x/oauth2?go-get=1
golang.org/x/oauth2 (download)
get "golang.org/x/net/context/ctxhttp": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at //golang.org/x/net/context/ctxhttp?go-get=1
get "golang.org/x/net/context/ctxhttp": verifying non-authoritative meta tag
golang.org/x/net (download)
The command '/bin/sh -c go get -v github.com/morphy2k/revive-action' returned a non-zero code: 1
##[error]Docker build failed with exit code 1
My projects:
work.go
work_darwin.go
work_linux.go
work_windows.go
For those files, revive only works that corresponding platform. e.g. on macOS it detects work_darwin.go only, and on Ubuntu, it works for work_linux.go
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.