From 09aa4d3f24e8358033cfae521aaa96c61332b87a Mon Sep 17 00:00:00 2001 From: James Spencer Date: Fri, 24 Mar 2023 15:39:19 +0000 Subject: [PATCH 1/6] chore(775): test --- githooks/commitmsg.js | 2 +- githooks/constants.js | 4 ++-- githooks/preparecommitmsg.js | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/githooks/commitmsg.js b/githooks/commitmsg.js index a83e039ec6..4ac7f448a0 100644 --- a/githooks/commitmsg.js +++ b/githooks/commitmsg.js @@ -6,7 +6,7 @@ const read = require('@commitlint/read'); const customMessages = { 'scope-enum': { - level2: 'The scope should be a Jira ticket number', + level2: 'The scope should be a GitHub issue number', }, }; diff --git a/githooks/constants.js b/githooks/constants.js index cb5aa511c6..f7a175a9d9 100644 --- a/githooks/constants.js +++ b/githooks/constants.js @@ -1,9 +1,9 @@ const chalk = require('chalk'); const TYPES = ['docs', 'feat', 'fix', 'refactor', 'revert', 'upkeep', 'spike']; -const SCOPE_REGEX = /^[A-Z]{2,5}-\d{1,5}$/; +const SCOPE_REGEX = /^(?:[A-Z]{1,5}|\d{1,5})-\d{1,5}$/; const PLAIN_PREFIX_ERROR_MSG = - "The commit message should be in the format 'type - fix/feat/etc(ticket-number): message'"; + "The commit message should be in the format 'type - fix/feat/etc(issue-number): message'"; const FORMATTED_PREFIX_ERROR_MSG = `The commit message should be in the format ${chalk.bold( "'type", )}${chalk.reset.dim(' - fix/feat/etc')}${chalk.bold( diff --git a/githooks/preparecommitmsg.js b/githooks/preparecommitmsg.js index dd50952212..23160ef8db 100644 --- a/githooks/preparecommitmsg.js +++ b/githooks/preparecommitmsg.js @@ -40,12 +40,11 @@ const createPrompts = ({type, scope}) => { SEM_VER_COMMIT_TYPES[SEM_VER_COMMIT_TYPES.length - 1], }, { - message: 'Enter the Jira ticket number for this commit', + message: 'Enter the github issue number for this commit', name: 'scope', transformer: input => input.toUpperCase(), type: 'input', - validate: input => - SCOPE_REGEX.test(input.toUpperCase()) || 'e.g. PPDSC-1608', + validate: input => SCOPE_REGEX.test(input.toUpperCase()) || 'e.g. 1608', when: !scope, }, ]; From ff58349cde7560337ed3b82fa55f3c93e4a6a60b Mon Sep 17 00:00:00 2001 From: James Spencer Date: Fri, 24 Mar 2023 15:43:03 +0000 Subject: [PATCH 2/6] chore(775): branch remove debug from coomit hook --- githooks/constants.js | 2 +- githooks/preparecommitmsg.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/githooks/constants.js b/githooks/constants.js index f7a175a9d9..c007ad4770 100644 --- a/githooks/constants.js +++ b/githooks/constants.js @@ -1,7 +1,7 @@ const chalk = require('chalk'); const TYPES = ['docs', 'feat', 'fix', 'refactor', 'revert', 'upkeep', 'spike']; -const SCOPE_REGEX = /^(?:[A-Z]{1,5}|\d{1,5})-\d{1,5}$/; +const SCOPE_REGEX = /^[A-Z]{2,5}-\d{1,5}|\d{1,5}$/; const PLAIN_PREFIX_ERROR_MSG = "The commit message should be in the format 'type - fix/feat/etc(issue-number): message'"; const FORMATTED_PREFIX_ERROR_MSG = `The commit message should be in the format ${chalk.bold( diff --git a/githooks/preparecommitmsg.js b/githooks/preparecommitmsg.js index 23160ef8db..2120673a24 100644 --- a/githooks/preparecommitmsg.js +++ b/githooks/preparecommitmsg.js @@ -68,7 +68,7 @@ const createPrompts = ({type, scope}) => { const getBranchData = ({type, scope}) => new Promise((resolve, reject) => { - const branchNameRegex = /^(?:(\w*)\/)?([a-z]{2,5}-\d{1,5})?/i; + const branchNameRegex = /^(?:(\w*)\/)?([a-z]{2,5}-\d{1,5}|\d{1,5})?/i; exec('git rev-parse --abbrev-ref HEAD', (err, stdout, stderr) => { if (stdout && typeof stdout === 'string') { const matches = stdout.trim().match(branchNameRegex); @@ -101,11 +101,14 @@ if (msgFilePath) { ) .then(({scope, type, ...parsed}) => { // remove any already defined type and scope info + const message = parsed.raw .replace(type, '') .replace(`(${scope})`, '') .replace(/^:\s? /, ''); + console.log(`commit lint, ${parsed.raw} ${type}, ${scope}, ${message}`); + return { message, scope, From 70af6801d797ed49a1e362272cab7b0b145b67d8 Mon Sep 17 00:00:00 2001 From: James Spencer Date: Fri, 24 Mar 2023 15:43:38 +0000 Subject: [PATCH 3/6] chore(775): update issue templates --- .github/ISSUE_TEMPLATE/a11y_investigation.md | 3 +-- .github/ISSUE_TEMPLATE/bug_report.md | 1 - .github/ISSUE_TEMPLATE/feature_request.md | 1 - .github/ISSUE_TEMPLATE/spike.md | 1 - .github/ISSUE_TEMPLATE/story.md | 3 +-- .github/ISSUE_TEMPLATE/task.md | 1 - 6 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/a11y_investigation.md b/.github/ISSUE_TEMPLATE/a11y_investigation.md index 41cc7cc4b9..a4db09fab8 100644 --- a/.github/ISSUE_TEMPLATE/a11y_investigation.md +++ b/.github/ISSUE_TEMPLATE/a11y_investigation.md @@ -1,7 +1,6 @@ --- name: A11y Investigation -about: Details an accessibility investigation that needs to be done -title: '(A11y) - ' +about: Details an accessibility investigation that needs to be done labels: ["a11y", "triage"] assignees: '' diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 93c841a2c3..1fb2d7d1c7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,6 @@ --- name: Bug report about: Create a report to help us improve -title: '(Bug) - ' labels: ["bug", "triage"] assignees: '' diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 60079188ab..0361d36395 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,6 @@ --- name: Feature request about: Suggest a feature/enhancement for NewsKit - External teams should use this instead of story,task,spike etc. -title: '' labels: ["request", "triage"] assignees: '' diff --git a/.github/ISSUE_TEMPLATE/spike.md b/.github/ISSUE_TEMPLATE/spike.md index ff905ed1cb..0a5889e0c5 100644 --- a/.github/ISSUE_TEMPLATE/spike.md +++ b/.github/ISSUE_TEMPLATE/spike.md @@ -1,7 +1,6 @@ --- name: Technical Spike about: Details a piece of technical research or an investigation that needs to be conducted -title: '(Spike) - ' labels: ["spike", "triage"] assignees: '' diff --git a/.github/ISSUE_TEMPLATE/story.md b/.github/ISSUE_TEMPLATE/story.md index d2e79f2ba2..9b054ce7b4 100644 --- a/.github/ISSUE_TEMPLATE/story.md +++ b/.github/ISSUE_TEMPLATE/story.md @@ -1,7 +1,6 @@ --- name: User Story -about: Details a specific user facing feature -title: '(Story) - ' +about: Details a specific user facing feature labels: ["story", "triage"] assignees: '' diff --git a/.github/ISSUE_TEMPLATE/task.md b/.github/ISSUE_TEMPLATE/task.md index 28cae8c0bc..de9b4370e7 100644 --- a/.github/ISSUE_TEMPLATE/task.md +++ b/.github/ISSUE_TEMPLATE/task.md @@ -1,7 +1,6 @@ --- name: Task about: Details a task -title: '(Task) - ' labels: ["task", "triage"] assignees: '' From 29a5e5075bb9ae9485867d2f8fdd3bbcf8e1292a Mon Sep 17 00:00:00 2001 From: James Spencer Date: Fri, 24 Mar 2023 15:45:51 +0000 Subject: [PATCH 4/6] chore(775): fix issue with docs not being seperated in release notes --- .github/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release.yml b/.github/release.yml index c1394a974b..5a7d154bde 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -16,7 +16,7 @@ changelog: - fix - title: Documentation 📝 labels: - - doc + - docs - title: Other Changes 🧱 labels: - "*" \ No newline at end of file From 80315d4a65dad4a34ca6a3bc04eb13c63166b5f5 Mon Sep 17 00:00:00 2001 From: James Spencer Date: Fri, 24 Mar 2023 15:51:15 +0000 Subject: [PATCH 5/6] chore(775): update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3bc92f8894..540c150ef7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,5 @@ -PPDSC-XXXX + +#000 **What** From 4203748f7887986dd41ace7fa0565bbba19b23f0 Mon Sep 17 00:00:00 2001 From: James Spencer Date: Fri, 24 Mar 2023 15:51:48 +0000 Subject: [PATCH 6/6] chore(775): remove debug log --- githooks/preparecommitmsg.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/githooks/preparecommitmsg.js b/githooks/preparecommitmsg.js index 2120673a24..46d3a770c2 100644 --- a/githooks/preparecommitmsg.js +++ b/githooks/preparecommitmsg.js @@ -107,8 +107,6 @@ if (msgFilePath) { .replace(`(${scope})`, '') .replace(/^:\s? /, ''); - console.log(`commit lint, ${parsed.raw} ${type}, ${scope}, ${message}`); - return { message, scope,