Skip to content

Commit

Permalink
improve patch result
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelst committed Sep 1, 2023
1 parent eed021d commit 05a4e7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11824,7 +11824,7 @@ const getChangedFiles = (octokit) => __awaiter(void 0, void 0, void 0, function*
patch = atob(encodedContent);
}
const changedLines = patch.split("\n").filter(line => line.startsWith("+"));
return Object.assign(Object.assign({}, acc), { [file.filename]: changedLines });
return Object.assign(Object.assign({}, (yield acc)), { [file.filename]: changedLines });
}), {});
});
exports.getChangedFiles = getChangedFiles;
Expand Down Expand Up @@ -11922,7 +11922,7 @@ function run() {
}
octokit.rest.checks.update(Object.assign(Object.assign({}, github.context.repo), { check_run_id: checkRun.id, conclusion: res.result.state }));
if (relevantForPatch && relevantForPatch > 0) {
octokit.rest.repos.createCommitStatus(Object.assign(Object.assign({}, github.context.repo), { sha: res.result.sha, state: coveredForPatch === relevantForPatch ? "success" : "failure", context: "coverbot (patch)", description: `${coveredForPatch} lines covered out of ${relevantForPatch} (${patchPercentage}%)` }));
octokit.rest.repos.createCommitStatus(Object.assign(Object.assign({}, github.context.repo), { sha: res.result.sha, state: Number(patchPercentage) >= Number(percentage) ? "success" : "failure", context: "coverbot (patch)", description: `${coveredForPatch} lines covered out of ${relevantForPatch} (${patchPercentage}%)` }));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/changed-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ export const getChangedFiles = async (

const changedLines = patch.split("\n").filter(line => line.startsWith("+"))

return { ...acc, [file.filename]: changedLines } as ChangedFiles
return { ...(await acc), [file.filename]: changedLines } as ChangedFiles
}, {})
}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function run(): Promise<void> {
octokit.rest.repos.createCommitStatus({
...github.context.repo,
sha: res.result.sha,
state: coveredForPatch === relevantForPatch ? "success" : "failure",
state: Number(patchPercentage) >= Number(percentage) ? "success" : "failure",
context: "coverbot (patch)",
description: `${coveredForPatch} lines covered out of ${relevantForPatch} (${patchPercentage}%)`,
})
Expand Down

0 comments on commit 05a4e7b

Please sign in to comment.