diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index aae323e2b..184ffddb0 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -3,6 +3,9 @@ on: pull_request: types: [opened, synchronize, reopened, edited, ready_for_review] +permissions: + pull-requests: write + jobs: build: name: Changelogs diff --git a/dangerfile.js b/dangerfile.js index fb3e3c4ed..001e4f1a2 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -34,11 +34,26 @@ async function containsChangelog(path) { return contents.includes(PR_LINK); } -async function checkChangelog() { - const skipChangelog = - danger.github && (danger.github.pr.body + "").includes("#skip-changelog"); +function skipChangelog() { + if (!danger.github) { + return false; + } + if ((danger.github.pr.body + "").includes("#skip-changelog")) { + // The PR description can always contain skip-changelog + return true; + } + for (let comment of danger.github.api.getPullRequestComments) { + // If a comment in a command to dependabot we also accept a #skip-changelog marker there + if (comment.body.includes("@dependabot") + && comment.body.includes("#skip-changelog")) { + return true; + } + } + return false; +} - if (skipChangelog) { +async function checkChangelog() { + if (skipChangelog()) { return; }