Skip to content

Commit

Permalink
allow suffixes on "no qa needed"
Browse files Browse the repository at this point in the history
  • Loading branch information
dbjorge committed Aug 19, 2024
1 parent 1096fe8 commit c047b52
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/actions/semantic-pr-footer-v1/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29251,9 +29251,9 @@ const validFooterPrefixes = [
];
const validFooters = ['no qa needed', 'no qa required'];
const validFooterPrefixRegex = new RegExp(`^(${validFooterPrefixes.join('|')}):? `, 'i');
const validFooterRegex = new RegExp(`^(${validFooters.join('|')})`, 'i');
function isValidFooter(footer) {
footer = footer.toLowerCase();
return validFooters.includes(footer) || validFooterPrefixRegex.test(footer);
return validFooterRegex.test(footer) || validFooterPrefixRegex.test(footer);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ describe('isValidFooter', () => {
'QA Notes ',
'QA Notes: ',
'No QA required',
'No QA needed'
'No QA needed',
'No QA required (test only)',
'No QA needed: validate as part of separate ticket'
]

for (const validCase of validCases) {
Expand Down
8 changes: 5 additions & 3 deletions .github/actions/semantic-pr-footer-v1/src/isValidFooter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// These must appear with a suffix (eg, "fix #123" or "QA Notes: test X, Y, and Z")
const validFooterPrefixes = [
// Should accept all github terms that link an issue
// @see https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
Expand All @@ -15,14 +16,15 @@ const validFooterPrefixes = [
'refs',
'qa notes'
]

// These may appear alone or with a suffix (eg, "no qa needed" or "no qa needed (test only)")
const validFooters = ['no qa needed', 'no qa required']

const validFooterPrefixRegex = new RegExp(
`^(${validFooterPrefixes.join('|')}):? `,
'i'
)
const validFooterRegex = new RegExp(`^(${validFooters.join('|')})`, 'i')
export default function isValidFooter(footer: string): boolean {
footer = footer.toLowerCase()

return validFooters.includes(footer) || validFooterPrefixRegex.test(footer)
return validFooterRegex.test(footer) || validFooterPrefixRegex.test(footer)
}

0 comments on commit c047b52

Please sign in to comment.