diff --git a/.github/matchers/check.json b/.github/matchers/check.json new file mode 100644 index 0000000..73bc49a --- /dev/null +++ b/.github/matchers/check.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "ruff-check", + "pattern": [ + { + "regexp": "^Error: (.*):(\\d+):(\\d+): (\\w+) (.*)$", + "file": 1, + "line": 2, + "column": 3, + "code": 4, + "message": 5 + } + ] + } + ] +} diff --git a/.github/matchers/format.json b/.github/matchers/format.json new file mode 100644 index 0000000..23bddd1 --- /dev/null +++ b/.github/matchers/format.json @@ -0,0 +1,14 @@ +{ + "problemMatcher": [ + { + "owner": "ruff-format", + "pattern": [ + { + "regexp": "^(Would reformat):\\s*(.+)$", + "message": 1, + "file": 2 + } + ] + } + ] +} diff --git a/dist/ruff-action/index.js b/dist/ruff-action/index.js index caf4fec..9f31d51 100644 Binary files a/dist/ruff-action/index.js and b/dist/ruff-action/index.js differ diff --git a/src/ruff-action.ts b/src/ruff-action.ts index ae28828..38424f0 100644 --- a/src/ruff-action.ts +++ b/src/ruff-action.ts @@ -36,6 +36,7 @@ async function run(): Promise { addRuffToPath(setupResult.ruffDir); setOutputFormat(); + addMatchers(); core.setOutput("ruff-version", setupResult.version); core.info(`Successfully installed ruff version ${setupResult.version}`); @@ -92,6 +93,17 @@ function setOutputFormat() { core.info("Set RUFF_OUTPUT_FORMAT to github"); } +function addMatchers(): void { + const matchersPath = path.join( + __dirname, + `..${path.sep}..`, + ".github", + "matchers", + ); + core.info(`##[add-matcher]${path.join(matchersPath, "check.json")}`); + core.info(`##[add-matcher]${path.join(matchersPath, "format.json")}`); +} + async function runRuff( ruffExecutablePath: string, args: string[],