Skip to content

Commit 4c5eb28

Browse files
refactor: clean check_skip_if_match.cjs (#8020)
1 parent 0c52650 commit 4c5eb28

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

actions/setup/js/check_skip_if_match.cjs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { getErrorMessage } = require("./error_helpers.cjs");
66
async function main() {
77
const skipQuery = process.env.GH_AW_SKIP_QUERY;
88
const workflowName = process.env.GH_AW_WORKFLOW_NAME;
9-
const maxMatchesStr = process.env.GH_AW_SKIP_MAX_MATCHES || "1";
9+
const maxMatchesStr = process.env.GH_AW_SKIP_MAX_MATCHES ?? "1";
1010

1111
if (!skipQuery) {
1212
core.setFailed("Configuration error: GH_AW_SKIP_QUERY not specified.");
@@ -27,20 +27,15 @@ async function main() {
2727
core.info(`Checking skip-if-match query: ${skipQuery}`);
2828
core.info(`Maximum matches threshold: ${maxMatches}`);
2929

30-
// Get repository information from context
3130
const { owner, repo } = context.repo;
32-
33-
// Scope the query to the current repository
3431
const scopedQuery = `${skipQuery} repo:${owner}/${repo}`;
3532

3633
core.info(`Scoped query: ${scopedQuery}`);
3734

3835
try {
39-
// Search for issues and pull requests using the GitHub API
40-
// We only need to know if the count reaches the threshold
4136
const response = await github.rest.search.issuesAndPullRequests({
4237
q: scopedQuery,
43-
per_page: 1, // We only need the count, not the items
38+
per_page: 1,
4439
});
4540

4641
const totalCount = response.data.total_count;
@@ -56,7 +51,6 @@ async function main() {
5651
core.setOutput("skip_check_ok", "true");
5752
} catch (error) {
5853
core.setFailed(`Failed to execute search query: ${getErrorMessage(error)}`);
59-
return;
6054
}
6155
}
6256

0 commit comments

Comments
 (0)