diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index afe87665..40243b58 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -48,4 +48,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - npx danger ci --dangerfile ./dangerfile --failOnErrors --text-only + npx danger ci --dangerfile dangerfile.cjs --failOnErrors --text-only diff --git a/dangerfile.cjs b/dangerfile.cjs index 98ca4102..b396c269 100644 --- a/dangerfile.cjs +++ b/dangerfile.cjs @@ -1,38 +1,40 @@ -let { danger, fail } = require(`danger`) +let { danger, warn } = require(`danger`) -let APP_PREFIX = /** @type {const} */ (`wd`) -let ENVIRONMENTS = /** @type {const} */ ([`production`, `development`]) +warn(danger.github.pr.title) -let environmentsPattern = ENVIRONMENTS.join(`|`) +// let APP_PREFIX = /** @type {const} */ (`wd`) +// let ENVIRONMENTS = /** @type {const} */ ([`production`, `development`]) -let Config = /** @type {const} */ ({ - BRANCH_PATTERN: new RegExp( - `^((${APP_PREFIX})-[0-9]{1,6})-[a-zA-Z0-9-]+$|(${environmentsPattern})$`, - ), - IS_ASSIGNEE_REQUIRED: true, - TITLE_PATTERN: new RegExp( - `^((${APP_PREFIX})-[0-9]{1,6}): (.*\\S)$|(${environmentsPattern}) to (${environmentsPattern})$`, - ), -}) +// let environmentsPattern = ENVIRONMENTS.join(`|`) -let isTitleValid = Config.TITLE_PATTERN.test(danger.github.pr.title) +// let Config = /** @type {const} */ ({ +// BRANCH_PATTERN: new RegExp( +// `^((${APP_PREFIX})-[0-9]{1,6})-[a-zA-Z0-9-]+$|(${environmentsPattern})$`, +// ), +// IS_ASSIGNEE_REQUIRED: true, +// TITLE_PATTERN: new RegExp( +// `^((${APP_PREFIX})-[0-9]{1,6}): (.*\\S)$|(${environmentsPattern}) to (${environmentsPattern})$`, +// ), +// }) -if (!isTitleValid) { - fail( - `Pull Request title should match the following pattern – ${Config.TITLE_PATTERN}.`, - ) -} +// let isTitleValid = Config.TITLE_PATTERN.test(danger.github.pr.title) -let isBranchValid = Config.BRANCH_PATTERN.test(danger.github.pr.head.ref) +// if (!isTitleValid) { +// fail( +// `Pull Request title should match the following pattern – ${Config.TITLE_PATTERN}.`, +// ) +// } -if (!isBranchValid) { - fail( - `Pull Request branch should match the following pattern – ${Config.BRANCH_PATTERN}.`, - ) -} +// let isBranchValid = Config.BRANCH_PATTERN.test(danger.github.pr.head.ref) -let hasAssignee = Boolean(danger.github.pr.assignee) +// if (!isBranchValid) { +// fail( +// `Pull Request branch should match the following pattern – ${Config.BRANCH_PATTERN}.`, +// ) +// } -if (Config.IS_ASSIGNEE_REQUIRED && !hasAssignee) { - fail(`Pull Request should have at least one assignee.`) -} +// let hasAssignee = Boolean(danger.github.pr.assignee) + +// if (Config.IS_ASSIGNEE_REQUIRED && !hasAssignee) { +// fail(`Pull Request should have at least one assignee.`) +// }