mirror of
https://github.com/actions-rs/cargo.git
synced 2024-11-15 05:56:33 +02:00
Enabling rustfmt problem matcher on demand
This commit is contained in:
parent
333d0cf286
commit
d45f23b72c
4 changed files with 21 additions and 14 deletions
|
@ -2,11 +2,13 @@
|
||||||
"problemMatcher": [
|
"problemMatcher": [
|
||||||
{
|
{
|
||||||
"owner": "rustfmt",
|
"owner": "rustfmt",
|
||||||
"pattern": {
|
"pattern": [
|
||||||
|
{
|
||||||
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
||||||
"file": 1,
|
"file": 1,
|
||||||
"line": 2
|
"line": 2
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
4
dist/.matchers/rustfmt.json
vendored
4
dist/.matchers/rustfmt.json
vendored
|
@ -2,11 +2,13 @@
|
||||||
"problemMatcher": [
|
"problemMatcher": [
|
||||||
{
|
{
|
||||||
"owner": "rustfmt",
|
"owner": "rustfmt",
|
||||||
"pattern": {
|
"pattern": [
|
||||||
|
{
|
||||||
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
"regexp": "^Diff in (\\S+) at line (\\d+):$",
|
||||||
"file": 1,
|
"file": 1,
|
||||||
"line": 2
|
"line": 2
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -24,11 +24,14 @@ export async function run(actionInput: input.Input): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
|
const actionInput = input.get();
|
||||||
|
|
||||||
const matchersPath = path.join(__dirname, '.matchers');
|
const matchersPath = path.join(__dirname, '.matchers');
|
||||||
console.log(`::add-matcher::${path.join(matchersPath, 'rust.json')}`);
|
console.log(`::add-matcher::${path.join(matchersPath, 'rust.json')}`);
|
||||||
|
// Enabling `rustfmt` problem matcher only if `cargo fmt` is called
|
||||||
|
if (actionInput.command == 'fmt') {
|
||||||
console.log(`::add-matcher::${path.join(matchersPath, 'rustfmt.json')}`);
|
console.log(`::add-matcher::${path.join(matchersPath, 'rustfmt.json')}`);
|
||||||
|
}
|
||||||
const actionInput = input.get();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await run(actionInput);
|
await run(actionInput);
|
||||||
|
|
Loading…
Reference in a new issue