Skip to content

Commit

Permalink
Adding output - result of the check
Browse files Browse the repository at this point in the history
  • Loading branch information
karpikpl committed May 8, 2024
1 parent 1d8cd48 commit 704bcd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ inputs:
github_configuration_token:
description: the github access token to be used to access the config file using other github_configuration_* parameters. can differ from GITHUB_TOKEN. defaults to GITHUB_TOKEN
required: false
outputs:
success:
description: true if the PR title is valid, false otherwise. Undefined if an error occurred.
runs:
using: node20
main: dist/index.js
4 changes: 4 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10050,6 +10050,7 @@ const run = ({ configPath, localConfigPath, remoteConfigURL, GitHubConfigOwner,
if (labels[i].name == CHECKS.ignoreLabels[j]) {
core.info(`Ignoring Title Check for label - ${labels[i].name}`);
removeLabel({ labels, name: LABEL.name });
core.setOutput("success", true);
return;
}
}
Expand All @@ -10060,6 +10061,7 @@ const run = ({ configPath, localConfigPath, remoteConfigURL, GitHubConfigOwner,
if (title.startsWith(CHECKS.prefixes[i])) {
removeLabel({ labels, name: LABEL.name });
core.info(MESSAGES.success);
core.setOutput("success", true);
return;
}
}
Expand All @@ -10069,10 +10071,12 @@ const run = ({ configPath, localConfigPath, remoteConfigURL, GitHubConfigOwner,
if (re.test(title)) {
removeLabel({ labels, name: LABEL.name });
core.info(MESSAGES.success);
core.setOutput("success", true);
return;
}
}
yield titleCheckFailed({ config: { LABEL, CHECKS, MESSAGES } });
core.setOutput("success", false);
}
catch (error) {
core.info(error);
Expand Down
4 changes: 4 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ const run = async ({
if (labels[i].name == CHECKS.ignoreLabels[j]) {
core.info(`Ignoring Title Check for label - ${labels[i].name}`);
removeLabel({ labels, name: LABEL.name });
core.setOutput("success", true);
return;
}
}
Expand All @@ -295,6 +296,7 @@ const run = async ({
if (title.startsWith(CHECKS.prefixes[i])) {
removeLabel({ labels, name: LABEL.name });
core.info(MESSAGES.success);
core.setOutput("success", true);
return;
}
}
Expand All @@ -305,11 +307,13 @@ const run = async ({
if (re.test(title)) {
removeLabel({ labels, name: LABEL.name });
core.info(MESSAGES.success);
core.setOutput("success", true);
return;
}
}

await titleCheckFailed({ config: { LABEL, CHECKS, MESSAGES } });
core.setOutput("success", false);
} catch (error) {
core.info(error);
}
Expand Down

0 comments on commit 704bcd3

Please sign in to comment.