mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-14 20:41:15 +00:00
build(deps-dev): Bump typescript from 4.3.5 to 4.4.2 (#401)
* build(deps-dev): Bump typescript from 4.3.5 to 4.4.2 Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.3.5 to 4.4.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.3.5...v4.4.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * ♻️ guard error object https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#use-unknown-catch-variables Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: marocchino <marocchino@users.noreply.github.com>
This commit is contained in:
parent
5ec4a629b2
commit
136dcf90b9
8 changed files with 37 additions and 25 deletions
22
dist/index.js
generated
vendored
22
dist/index.js
generated
vendored
|
|
@ -128,10 +128,12 @@ function buildBody() {
|
|||
const path = core.getInput("path", { required: false });
|
||||
if (path) {
|
||||
try {
|
||||
return fs_1.readFileSync(path, "utf-8");
|
||||
return (0, fs_1.readFileSync)(path, "utf-8");
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -195,25 +197,27 @@ function run() {
|
|||
throw new Error("delete and recreate cannot be both set to true");
|
||||
}
|
||||
const octokit = github.getOctokit(config_1.githubToken);
|
||||
const previous = yield comment_1.findPreviousComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);
|
||||
const previous = yield (0, comment_1.findPreviousComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);
|
||||
if (!previous) {
|
||||
yield comment_1.createComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header);
|
||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header);
|
||||
return;
|
||||
}
|
||||
if (config_1.deleteOldComment) {
|
||||
yield comment_1.deleteComment(octokit, config_1.repo, previous.id);
|
||||
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
|
||||
return;
|
||||
}
|
||||
const previousBody = config_1.append ? previous.body : undefined;
|
||||
if (config_1.recreate) {
|
||||
yield comment_1.deleteComment(octokit, config_1.repo, previous.id);
|
||||
yield comment_1.createComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody);
|
||||
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
|
||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody);
|
||||
return;
|
||||
}
|
||||
yield comment_1.updateComment(octokit, config_1.repo, previous.id, config_1.body, config_1.header, previousBody);
|
||||
yield (0, comment_1.updateComment)(octokit, config_1.repo, previous.id, config_1.body, config_1.header, previousBody);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
lib/config.js
generated
6
lib/config.js
generated
|
|
@ -43,10 +43,12 @@ function buildBody() {
|
|||
const path = core.getInput("path", { required: false });
|
||||
if (path) {
|
||||
try {
|
||||
return fs_1.readFileSync(path, "utf-8");
|
||||
return (0, fs_1.readFileSync)(path, "utf-8");
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
lib/main.js
generated
16
lib/main.js
generated
|
|
@ -46,25 +46,27 @@ function run() {
|
|||
throw new Error("delete and recreate cannot be both set to true");
|
||||
}
|
||||
const octokit = github.getOctokit(config_1.githubToken);
|
||||
const previous = yield comment_1.findPreviousComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);
|
||||
const previous = yield (0, comment_1.findPreviousComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.header);
|
||||
if (!previous) {
|
||||
yield comment_1.createComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header);
|
||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header);
|
||||
return;
|
||||
}
|
||||
if (config_1.deleteOldComment) {
|
||||
yield comment_1.deleteComment(octokit, config_1.repo, previous.id);
|
||||
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
|
||||
return;
|
||||
}
|
||||
const previousBody = config_1.append ? previous.body : undefined;
|
||||
if (config_1.recreate) {
|
||||
yield comment_1.deleteComment(octokit, config_1.repo, previous.id);
|
||||
yield comment_1.createComment(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody);
|
||||
yield (0, comment_1.deleteComment)(octokit, config_1.repo, previous.id);
|
||||
yield (0, comment_1.createComment)(octokit, config_1.repo, config_1.pullRequestNumber, config_1.body, config_1.header, previousBody);
|
||||
return;
|
||||
}
|
||||
yield comment_1.updateComment(octokit, config_1.repo, previous.id, config_1.body, config_1.header, previousBody);
|
||||
yield (0, comment_1.updateComment)(octokit, config_1.repo, previous.id, config_1.body, config_1.header, previousBody);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
6
package-lock.json
generated
6
package-lock.json
generated
|
|
@ -6233,9 +6233,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz",
|
||||
"integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==",
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||
"dev": true
|
||||
},
|
||||
"unbox-primitive": {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,6 @@
|
|||
"js-yaml": "^4.1.0",
|
||||
"prettier": "2.3.2",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^4.3.5"
|
||||
"typescript": "^4.4.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ function buildBody(): string {
|
|||
try {
|
||||
return readFileSync(path, "utf-8")
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,9 @@ async function run(): Promise<undefined> {
|
|||
|
||||
await updateComment(octokit, repo, previous.id, body, header, previousBody)
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue