@@ -92378,6 +92378,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
92378
92378
};
92379
92379
Object.defineProperty(exports, "__esModule", ({ value: true }));
92380
92380
exports.run = void 0;
92381
+ const path_1 = __nccwpck_require__(1017);
92381
92382
const core = __importStar(__nccwpck_require__(2186));
92382
92383
const exec = __importStar(__nccwpck_require__(1514));
92383
92384
const core_1 = __nccwpck_require__(4543);
@@ -92420,18 +92421,22 @@ async function buildContext(program) {
92420
92421
async function runClippy(actionInput, program) {
92421
92422
const args = buildArgs(actionInput);
92422
92423
const outputParser = new outputParser_1.OutputParser();
92424
+ const options = {
92425
+ ignoreReturnCode: true,
92426
+ failOnStdErr: false,
92427
+ listeners: {
92428
+ stdline: (line) => {
92429
+ outputParser.tryParseClippyLine(line);
92430
+ },
92431
+ },
92432
+ };
92433
+ if (actionInput.workingDirectory) {
92434
+ options.cwd = (0, path_1.join)(process.cwd(), actionInput.workingDirectory);
92435
+ }
92423
92436
let exitCode = 0;
92424
92437
try {
92425
92438
core.startGroup("Executing cargo clippy (JSON output)");
92426
- exitCode = await program.call(args, {
92427
- ignoreReturnCode: true,
92428
- failOnStdErr: false,
92429
- listeners: {
92430
- stdline: (line) => {
92431
- outputParser.tryParseClippyLine(line);
92432
- },
92433
- },
92434
- });
92439
+ exitCode = await program.call(args, options);
92435
92440
}
92436
92441
finally {
92437
92442
core.endGroup();
@@ -92549,7 +92554,8 @@ function get() {
92549
92554
return {
92550
92555
args: (0, string_argv_1.default)(core_1.input.getInput("args")),
92551
92556
useCross: core_1.input.getInputBool("use-cross"),
92552
- toolchain: toolchain !== "" ? toolchain : undefined,
92557
+ workingDirectory: core_1.input.getInput("working-directory") || undefined,
92558
+ toolchain: toolchain || undefined,
92553
92559
};
92554
92560
}
92555
92561
exports.get = get;
@@ -92587,12 +92593,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
92587
92593
};
92588
92594
Object.defineProperty(exports, "__esModule", ({ value: true }));
92589
92595
exports.OutputParser = void 0;
92596
+ const path_1 = __nccwpck_require__(1017);
92590
92597
const core = __importStar(__nccwpck_require__(2186));
92591
92598
const schema_1 = __nccwpck_require__(2199);
92592
92599
class OutputParser {
92600
+ _workingDirectory;
92593
92601
_uniqueAnnotations;
92594
92602
_stats;
92595
- constructor() {
92603
+ constructor(workingDirectory) {
92604
+ this._workingDirectory = workingDirectory ?? null;
92596
92605
this._uniqueAnnotations = new Map();
92597
92606
this._stats = {
92598
92607
ice: 0,
@@ -92626,7 +92635,7 @@ class OutputParser {
92626
92635
return;
92627
92636
}
92628
92637
const cargoMessage = contents;
92629
- const parsedAnnotation = OutputParser .makeAnnotation(cargoMessage);
92638
+ const parsedAnnotation = this .makeAnnotation(cargoMessage);
92630
92639
const key = JSON.stringify(parsedAnnotation);
92631
92640
if (this._uniqueAnnotations.has(key)) {
92632
92641
return;
@@ -92666,19 +92675,23 @@ class OutputParser {
92666
92675
/// Convert parsed JSON line into the GH annotation object
92667
92676
///
92668
92677
/// https://developer.github.com/v3/checks/runs/#annotations-object
92669
- static makeAnnotation(contents) {
92678
+ makeAnnotation(contents) {
92670
92679
const primarySpan = contents.message.spans.find((span) => {
92671
92680
return span.is_primary;
92672
92681
});
92673
92682
// TODO: Handle it properly
92674
92683
if (!primarySpan) {
92675
92684
throw new Error("Unable to find primary span for message");
92676
92685
}
92686
+ let path = primarySpan.file_name;
92687
+ if (this._workingDirectory) {
92688
+ path = (0, path_1.join)(this._workingDirectory, path);
92689
+ }
92677
92690
const annotation = {
92678
92691
level: OutputParser.parseLevel(contents.message.level),
92679
92692
message: contents.message.rendered,
92680
92693
properties: {
92681
- file: primarySpan.file_name ,
92694
+ file: path ,
92682
92695
startLine: primarySpan.line_start,
92683
92696
endLine: primarySpan.line_end,
92684
92697
title: contents.message.message,
0 commit comments