openstreetmap-website icon indicating copy to clipboard operation
openstreetmap-website copied to clipboard

Added workflow for PR labeling using Danger

Open nenad-vujicic opened this issue 1 year ago • 8 comments

This PR proposes possible solution for labeling pull requests using Danger described in #4912

Proposed solution introduces new workflow, executed whenever new PR is created or updated. Workflow checks if PR is too big (>500 changed lines) or changes one of translation files (YML, except en.yml) or contains merge-commits and generates appropriate labels using Danger and danger-auto_label plugin. If none of these is found, green "Good PR" is generated.

image

nenad-vujicic avatar Jul 15 '24 11:07 nenad-vujicic

Dear @tomhughes ,

Thanks for reviewing and comments. I've just updated with above fixes.

Regarding linear_history plugin, its implementation is exactly the same we are using in Dangerfile and it reports "Please rebase to get rid of the merge commits in this PR", so, is it better to install new gem for perhaps simpler code or to use current solution? I would be happy to replace with using linear_history plugin if required :-)

Regarding updating .rubocop.yml, it seems Dangerfile file is already being linted (without updating .rubocop.yml). Do we need some special adjustments?

Please, let me know if I could improve these further.

Thanks, Nenad.

nenad-vujicic avatar Jul 19 '24 13:07 nenad-vujicic

Rebased and updated Gemfile.lock to work with the latest sources.

nenad-vujicic avatar Aug 08 '24 23:08 nenad-vujicic

What do you mean by adding pre-commit hooks? If you mean that will run on people's checkouts then there is no way to add those to a repository in a way that means they will automatically be enabled in checkouts. We can certainly provide examples but people would have to enable them by hand.

tomhughes avatar Aug 13 '24 06:08 tomhughes

By adding pre-commit hooks, I mean providing a setup that contributors can manually enable/install to streamline the process of following our contributing guidelines before committing. While hooks can't be automatically enabled, we can provide contributors with scripts and instructions to simplify their setup. Tools like Overcommit for Ruby projects can be a good start for this.

kcne avatar Aug 13 '24 07:08 kcne

Hi @gravitystorm, did you maybe have a chance to take a look at this PR?

Thanks!

nenad-vujicic avatar Aug 16 '24 21:08 nenad-vujicic

Updated colors (see below screenshots) and message when there are no warnings (to "PR passed all labeling tests. It is small enough, doesn't contain merge-commits and doesn't change non-EN translations!").

image

Here is how they look in dark mode:

image

Improved green color for "Good" label.

Please, let me know if we can further improve it.

Thanks.

nenad-vujicic avatar Aug 22 '24 18:08 nenad-vujicic

Please rebase, to resolve conflicts in Gemfile.lock

gravitystorm avatar Aug 28 '24 14:08 gravitystorm

Please rebase, to resolve conflicts in Gemfile.lock

Rebased, thanks!

nenad-vujicic avatar Aug 28 '24 23:08 nenad-vujicic

Removed "Good" label and rebased again. Thanks!

nenad-vujicic avatar Oct 07 '24 10:10 nenad-vujicic

Merged, thanks! In particular, thanks for your patience and for the multiple rebases.

gravitystorm avatar Oct 16 '24 13:10 gravitystorm

Sadly this does not appear to be working properly ... https://github.com/openstreetmap/openstreetmap-website/actions/runs/11370083928/job/31629028217?pr=5266

tomhughes avatar Oct 16 '24 17:10 tomhughes