Skip to content

Fix Danger checks for invalid Changelogs

Gabriel Mazetto requested to merge fix-danger into master

What does this MR do?

Fix the previously identified issue, and improve current check by rescuing the correct errors for invalid YAML and warning when StandardError happens

Why was this MR needed?

Danger check had a ruby code issue in the logic, and it was raising an exception. Because the code was rescuing from StandardError it was hiding the ruby issue instead.

See failed build with debug info: https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/81464198

$ danger --fail-on-errors=true
You used `puts` in your Dangerfile. To print out text to GitHub use `message` instead
Passing the note body as a Hash is deprecated.  You should just pass the String.


YAML ISSUE: #<NameError: undefined local variable or method `changelog_path' for #<Danger::Dangerfile:0x0000562dab335228>>
Results:


Errors:
- [ ] <a href='https://gitlab.com/gitlab-org/gitlab-ce/blob/c123ea7f3c34a884cbbe338f793c55c14b5d4b29/changelogs/unreleased/ce-6064-geo-sql-query-for-counting-projects-with-wikis-is-very-slow.yml'>changelogs/unreleased/ce-6064-geo-sql-query-for-counting-projects-with-wikis-is-very-slow.yml</a> isn't valid YAML! See [the documentation](https://docs.gitlab.com/ce/development/changelog.html).

Merge request reports