Skip to content

Commit

Permalink
Better logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dub-wt committed Jun 13, 2024
1 parent d8ffa43 commit 2cbdbfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/__tests__/__snapshots__/run.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`run on failing should fails if doesn't match any of defined regexps 1`] = `"Pull Request title "$$$"fails to match any of the regex patterns: /[a-z ]+/, /\\d+/"`;
exports[`run on failing should fails if doesn't match any of defined regexps 1`] = `"Pull Request title fails to match any of the regex patterns."`;

exports[`run on failing should fails on regexp matching 1`] = `"Pull Request title "This is a pull request title"fails to match the regex pattern: /\\d/"`;
exports[`run on failing should fails on regexp matching 1`] = `"Pull Request title fails to match any of the regex patterns."`;

exports[`run on failing should fails on regexp matching with helper message if defined 1`] = `
"Pull Request title "This is a pull request title"fails to match the regex pattern: /\\d/
"Pull Request title fails to match any of the regex patterns.
Example of matching titles:
"[Example] example of title (US-6596)"
"
Expand Down
10 changes: 1 addition & 9 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ export const run = (context: Context) => {
}

if (!matches) {
let message = `Pull Request title "${pullRequestTitle}"`;

if (regexpList.length === 1) {
message += `fails to match the regex pattern: /${regexpList[0]}/`;
} else {
message += `fails to match any of the regex patterns: ${regexpList
.map((item) => `/${item}/`)
.join(", ")}`;
}
let message = `Pull Request title fails to match any of the regex patterns.`;

if (helpMessage) {
message += `\n${helpMessage}`;
Expand Down

0 comments on commit 2cbdbfb

Please sign in to comment.