Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency prettier to v3 #108

Merged
merged 2 commits into from Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -13,7 +13,7 @@
"@actions/github": "6.0.0",
"@types/node": "^20.11.30",
"@vercel/ncc": "0.38.1",
"prettier": "2.8.8",
"prettier": "3.2.5",
"typescript": "5.4.3"
},
"prettier": {
Expand Down
32 changes: 16 additions & 16 deletions sources/main.ts
Expand Up @@ -66,7 +66,7 @@ interface CheckDirtyContext {
retryMax: number;
}
async function checkDirty(
context: CheckDirtyContext
context: CheckDirtyContext,
): Promise<Record<number, boolean>> {
const {
after,
Expand Down Expand Up @@ -164,7 +164,7 @@ query openPullRequests($owner: String!, $repo: String!, $after: String, $baseRef
info(
`add "${dirtyLabel}", remove "${
removeOnDirtyLabel ? removeOnDirtyLabel : `nothing`
}"`
}"`,
);
// for labels PRs and issues are the same
const [addedDirtyLabel] = await Promise.all([
Expand All @@ -183,7 +183,7 @@ query openPullRequests($owner: String!, $repo: String!, $after: String, $baseRef
const removedDirtyLabel = await removeLabelIfExists(
dirtyLabel,
pullRequest,
{ client }
{ client },
);
if (removedDirtyLabel && commentOnClean !== "") {
await addComment(commentOnClean, pullRequest, { client });
Expand All @@ -206,13 +206,13 @@ query openPullRequests($owner: String!, $repo: String!, $after: String, $baseRef
...dirtyStatuses,
...newDirtyStatuses,
});
}
},
);
}, retryAfter * 1000);
});
default:
throw new TypeError(
`unhandled mergeable state '${pullRequest.mergeable}'`
`unhandled mergeable state '${pullRequest.mergeable}'`,
);
}
}
Expand All @@ -236,7 +236,7 @@ query openPullRequests($owner: String!, $repo: String!, $after: String, $baseRef
async function addLabelIfNotExists(
labelName: string,
issue: { number: number; labels: { nodes: Array<{ name: string }> } },
{ client }: { client: GitHub }
{ client }: { client: GitHub },
): Promise<boolean> {
core.debug(JSON.stringify(issue, null, 2));

Expand All @@ -247,7 +247,7 @@ async function addLabelIfNotExists(

if (hasLabel) {
core.info(
`Issue #${issue.number} already has label '${labelName}'. No need to add.`
`Issue #${issue.number} already has label '${labelName}'. No need to add.`,
);
return false;
}
Expand All @@ -268,28 +268,28 @@ async function addLabelIfNotExists(
error.message.endsWith(`Resource not accessible by integration`)
) {
core.warning(
`could not add label "${labelName}": ${commonErrorDetailedMessage}`
`could not add label "${labelName}": ${commonErrorDetailedMessage}`,
);
} else {
throw new Error(`error adding "${labelName}": ${error}`);
}
return false;
}
},
);
}

async function removeLabelIfExists(
labelName: string,
issue: { number: number; labels: { nodes: Array<{ name: string }> } },
{ client }: { client: GitHub }
{ client }: { client: GitHub },
): Promise<boolean> {
const hasLabel =
issue.labels.nodes.find((labe) => {
return labe.name === labelName;
}) !== undefined;
if (!hasLabel) {
core.info(
`Issue #${issue.number} does not have label '${labelName}'. No need to remove.`
`Issue #${issue.number} does not have label '${labelName}'. No need to remove.`,
);
return false;
}
Expand All @@ -310,24 +310,24 @@ async function removeLabelIfExists(
error.message.endsWith(`Resource not accessible by integration`)
) {
core.warning(
`could not remove label "${labelName}": ${commonErrorDetailedMessage}`
`could not remove label "${labelName}": ${commonErrorDetailedMessage}`,
);
} else if (error.status !== 404) {
throw new Error(`error removing "${labelName}": ${error}`);
} else {
core.info(
`On #${issue.number} label "${labelName}" doesn't need to be removed since it doesn't exist on that issue.`
`On #${issue.number} label "${labelName}" doesn't need to be removed since it doesn't exist on that issue.`,
);
}
return false;
}
},
);
}

async function addComment(
comment: string,
{ number }: { number: number },
{ client }: { client: GitHub }
{ client }: { client: GitHub },
): Promise<void> {
try {
await client.rest.issues.createComment({
Expand All @@ -343,7 +343,7 @@ async function addComment(
error.message.endsWith(`Resource not accessible by integration`)
) {
core.warning(
`couldn't add comment "${comment}": ${commonErrorDetailedMessage}`
`couldn't add comment "${comment}": ${commonErrorDetailedMessage}`,
);
} else {
throw new Error(`error adding "${comment}": ${error}`);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -149,10 +149,10 @@ once@^1.4.0:
dependencies:
wrappy "1"

prettier@2.8.8:
version "2.8.8"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
prettier@3.2.5:
version "3.2.5"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==

tunnel@^0.0.6:
version "0.0.6"
Expand Down