Skip to content

Commit

Permalink
add all code
Browse files Browse the repository at this point in the history
  • Loading branch information
alingse committed Jun 30, 2024
1 parent e5546fd commit de82189
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/jobs/alingse-makezero.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ includes:
excludes:
- assigned by index
- funcall
- called by funcs
issue_id: 1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: submit-repos
run-name: "submit repo urls for run-repo.yml"
run-name: "submit repo urls for go-linter-runner.yml"

on:
workflow_dispatch:
Expand All @@ -12,8 +12,8 @@ on:
workflow:
description: |
the workflow to submit with each repo
Default 'run-repo.yml'
default: "run-repo.yml"
Default 'go-linter-runner.yml'
default: "go-linter-runner.yml"

permissions:
actions: write
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
install_command: go install github.com/alingse/makezero@f6a823578e89de5cdfdfef50d4a5d9a09ade16dd
linter_command: makezero
includes: '["go", "github"]'
excludes: '["assigned by index", "funcall"]'
excludes: '["assigned by index", "funcall", "called by funcs"]'
issue_id: 1
repo_url: ${{ inputs.repo_url }}
env:
Expand Down
82 changes: 63 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,79 @@
# go-linter-runner

A launcher to run a specific linter for a large number of Go repositories using Github Actions.
使用 GitHub Actions 为公开的 Go 仓库运行 Go linter 并以 issue comment 的形式报告

# Why
# 背景

After implementing certain linters, you may want to check if online repositories also have similar issues.
在实现某些 linter 后,您可能希望检查在线仓库是否也存在类似的问题。例如,https://github.com/alingse/asasalinthttps://github.com/ashanbrown/makezero#15 都发现了大量的在线 bug
但是,手动观察 Actions 的结果并忽略一些特定的错误可能相当繁琐,因此可以使用此项目自动化

For example, https://github.com/alingse/asasalint and https://github.com/ashanbrown/makezero/pull/15
# 使用

Both have detected numerous online bugs.
推荐集成到 Github Workflow 中

However, manually observing the results of Actions and ignoring some specific errors can be quite exhausting.
## 配置检查单个 Repo 的 Workflow

Here, you can configure additional `includes` and `excludes` to exclude false-positives that don't need to be addressed.
参考 [`.github/workflows/go-linter-runner.yml`](https://github.com/alingse/go-linter-runner/blob/main/.github/workflows/go-linter-runner.yml) 配置安装和运行 linter 的参数

# Effects
```yaml
- name: Example -> go-linter-runner run with yaml job config
uses: alingse/go-linter-runner@main
with:
action: run
yaml_config: .github/jobs/alingse-makezero.yaml
repo_url: ${{ inputs.repo_url }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

see
1. https://github.com/alingse/go-linter-runner/issues/1
2. https://github.com/alingse/go-linter-runner/issues/2
- name: Example -> go-linter-runner use direct job config
uses: alingse/go-linter-runner@main
with:
action: run
install_command: go install github.com/alingse/makezero@f6a823578e89de5cdfdfef50d4a5d9a09ade16dd
linter_command: makezero
includes: '["go", "github"]'
excludes: '["assigned by index", "funcall", "called by funcs"]'
issue_id: 1
repo_url: ${{ inputs.repo_url }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

```

# Dev
## 配置提交大量检查任务的 Workflow

## storage
参考 [`.github/workflows/go-linter-runner-submit.yml`](https://github.com/alingse/go-linter-runner/blob/main/.github/workflows/go-linter-runner-submit.yml) 配置需要提交的信息

we use https://getpantry.cloud/ as center storage when run a job
```yaml
- name: Example -> go-linter-runner submit 10 repos
uses: alingse/go-linter-runner@main
with:
action: submit
submit_source_file: top.txt
submit_repo_count: ${{ inputs.count }}
submit_workflow: ${{ inputs.workflow }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
# TODO
## 以本地二进制文件运行
- [] Ability to configure more linter yaml
- [] Provide data aggregation (multiple failed Actions consolidated into a Sheet or a specific issue)
- [] Automatic issue creation for projects(may use AI)
- [] Automatic execution
```bash
go install github.com/alingse/go-linter-runner@latest
```

运行参考

```bash
go-linter-runner --help
```

# 其他

## Github 效果

参考 https://github.com/alingse/go-linter-runner/issues/1 的最新评论效果

# 贡献

欢迎试用, 提交 Issue 和 Pull Request!
5 changes: 2 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ inputs:
repo_url:
description: |
The repo to run lint, only work for github repo now
required: true
workdir:
description: |
'run' option: Work directory.
Expand Down Expand Up @@ -59,8 +58,8 @@ inputs:
submit_workflow:
description: |
'submit' option: the workflow to auto
Default 'run-repo.yml'
default: 'run-repo.yml'
Default 'go-linter-runner.yml'
default: 'go-linter-runner.yml'

runs:
using: "composite"
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var rootCmd = &cobra.Command{
Use: "go-linter-runner",
Short: "A cli to run linter for repos use github action",
Long: `A cli for run linter for github repo, and it post the result as issue comment,
It can submit many run-repo.yml task by trigger many github workflow action`,
It can submit many go-linter-runner.yml task by trigger many github workflow action`,
}

func Execute() {
Expand Down
1 change: 1 addition & 0 deletions linter-config-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ includes:
excludes:
- assigned by index
- funcall
- called by funcs
issue_id: 1

0 comments on commit de82189

Please sign in to comment.