Skip to content

Commit

Permalink
add back comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jamieomaguire committed Nov 29, 2024
1 parent 9064e9a commit f9c36af
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ danger.git.created_files
const numberOfCategories = changesetCategories ? changesetCategories.length : 0;

if (isDependabotPR) {
// Check if at least one of the valid changeset categories is present
if (numberOfCategories === 0) {
fail(`:memo: Your changeset doesn't include a category. Please add one of: \`${validChangesetCategories.join(', ')}\`. Filepath: \`${filepath}`);
} else if (!validChangesetCategories.some((cat) => changesetCategories.includes(cat))) {
fail(`:memo: Your changeset includes an invalid category. Please use one of: \`${validChangesetCategories.join(', ')}\`. Filepath: \`${filepath}`);
}

// Check that categories are followed are in the following format `[Category] - {Description}`
const changesetLineFormatRegex = /\[\w+\] - [\S].+/g;
const validChangesetEntries = diffString.match(changesetLineFormatRegex);
const numberOfValidChangesetEntries = validChangesetEntries ? validChangesetEntries.length : 0;
Expand Down

0 comments on commit f9c36af

Please sign in to comment.