Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(danger): Do not require changelogs from dependabot #714

Merged
merged 4 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
pull_request:
types: [opened, synchronize, reopened, edited, ready_for_review]

permissions:
pull-requests: write

jobs:
build:
name: Changelogs
Expand Down
23 changes: 19 additions & 4 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down