spotbugs github action
v1.2
此操作将spotbugs(或findbugs)的结果作为检查运行注释。
该动作也可以用于以XML格式生成报告的任何其他静态分析工具。该报告本身必须在以前的构建步骤中生成,例如Maven构建。

path必需的。文件,目录或通配符模式,可描述在哪里找到报告。可以通过Glob表达式处理多个文件,例如: '**/spotbugsXml.xml' 。
name选修的。运行支票的名称要创建。默认为spotbugs 。
title选修的。支票运行的标题要创建。默认为SpotBugs Source Code Analyzer report 。
token选修的。 github api访问令牌。默认为${{ github.token }} ,该}是由actions/checkout@v2最小化设置的。
name : Java CI
on : [push]
jobs :
build :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v2
- name : Set up JDK 1.8
uses : actions/setup-java@v1
with :
java-version : 1.8
- uses : actions/cache@v1
with :
path : ~/.m2/repository
key : ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys : |
${{ runner.os }}-maven-
- name : Build with Maven
run : mvn -B verify spotbugs:spotbugs
- uses : jwgmeligmeyling/spotbugs-github-action@master
with :
path : ' **/spotbugsXml.xml '并且不要忘记为Maven插件启用XML输出:
< build >
< plugins >
< plugin >
< groupId >com.github.spotbugs</ groupId >
< artifactId >spotbugs-maven-plugin</ artifactId >
< version >4.0.0</ version >
< configuration >
< xmlOutput >true</ xmlOutput >
< failOnError >false</ failOnError >
</ configuration >
</ plugin >
</ plugins >
</ build >请注意,默认情况下, pull_request事件上的工作流结帐refs/pull/:prNumber/merge而不是拉请求的头部。因此,生成的违规行为的行号可能与它们在HEAD上显示的实际线号不符。实际上,实际上并没有一种明智的方法可以在拉动请求的合并提交中运行此操作,因为结果将发布到未命名的工作流程中,以进行原本隐形的提交。即使对于pull_request事件,也有可能检查拉申请头。为此,请相应地更改您的checkout行动:
- uses : actions/checkout@v2
with :
ref : ${{ github.event.pull_request.head.sha }} 这是一系列其他GitHub动作中的GitHub动作。类似的行动包括:
由于GitHub API的限制,我们无法指定应关联新创建的检查运行的工作流程运行(或基础检查套件)。结果,触发几种类型的事件的工作流程可能会在另一个事件下推动结果,而不是进行操作。有关更多信息,请参见:#3
安装依赖项
$ npm install构建打字稿并打包以进行分发
$ npm run build && npm run package运行测试✔️
$ npm test
PASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)
...