Skip to content

Commit 535da08

Browse files
feat: build to update dist
1 parent 640b372 commit 535da08

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

dist/index.js

+27-14
Original file line numberDiff line numberDiff line change
@@ -92378,6 +92378,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
9237892378
};
9237992379
Object.defineProperty(exports, "__esModule", ({ value: true }));
9238092380
exports.run = void 0;
92381+
const path_1 = __nccwpck_require__(1017);
9238192382
const core = __importStar(__nccwpck_require__(2186));
9238292383
const exec = __importStar(__nccwpck_require__(1514));
9238392384
const core_1 = __nccwpck_require__(4543);
@@ -92420,18 +92421,22 @@ async function buildContext(program) {
9242092421
async function runClippy(actionInput, program) {
9242192422
const args = buildArgs(actionInput);
9242292423
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+
}
9242392436
let exitCode = 0;
9242492437
try {
9242592438
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);
9243592440
}
9243692441
finally {
9243792442
core.endGroup();
@@ -92549,7 +92554,8 @@ function get() {
9254992554
return {
9255092555
args: (0, string_argv_1.default)(core_1.input.getInput("args")),
9255192556
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,
9255392559
};
9255492560
}
9255592561
exports.get = get;
@@ -92587,12 +92593,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
9258792593
};
9258892594
Object.defineProperty(exports, "__esModule", ({ value: true }));
9258992595
exports.OutputParser = void 0;
92596+
const path_1 = __nccwpck_require__(1017);
9259092597
const core = __importStar(__nccwpck_require__(2186));
9259192598
const schema_1 = __nccwpck_require__(2199);
9259292599
class OutputParser {
92600+
_workingDirectory;
9259392601
_uniqueAnnotations;
9259492602
_stats;
92595-
constructor() {
92603+
constructor(workingDirectory) {
92604+
this._workingDirectory = workingDirectory ?? null;
9259692605
this._uniqueAnnotations = new Map();
9259792606
this._stats = {
9259892607
ice: 0,
@@ -92626,7 +92635,7 @@ class OutputParser {
9262692635
return;
9262792636
}
9262892637
const cargoMessage = contents;
92629-
const parsedAnnotation = OutputParser.makeAnnotation(cargoMessage);
92638+
const parsedAnnotation = this.makeAnnotation(cargoMessage);
9263092639
const key = JSON.stringify(parsedAnnotation);
9263192640
if (this._uniqueAnnotations.has(key)) {
9263292641
return;
@@ -92666,19 +92675,23 @@ class OutputParser {
9266692675
/// Convert parsed JSON line into the GH annotation object
9266792676
///
9266892677
/// https://developer.github.com/v3/checks/runs/#annotations-object
92669-
static makeAnnotation(contents) {
92678+
makeAnnotation(contents) {
9267092679
const primarySpan = contents.message.spans.find((span) => {
9267192680
return span.is_primary;
9267292681
});
9267392682
// TODO: Handle it properly
9267492683
if (!primarySpan) {
9267592684
throw new Error("Unable to find primary span for message");
9267692685
}
92686+
let path = primarySpan.file_name;
92687+
if (this._workingDirectory) {
92688+
path = (0, path_1.join)(this._workingDirectory, path);
92689+
}
9267792690
const annotation = {
9267892691
level: OutputParser.parseLevel(contents.message.level),
9267992692
message: contents.message.rendered,
9268092693
properties: {
92681-
file: primarySpan.file_name,
92694+
file: path,
9268292695
startLine: primarySpan.line_start,
9268392696
endLine: primarySpan.line_end,
9268492697
title: contents.message.message,

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)