openwrt icon indicating copy to clipboard operation
openwrt copied to clipboard

CI: include automatic Pull Request Labeler

Open pepe2k opened this issue 2 years ago • 16 comments

This adds GitHub CI action which makes use of 'Labeler', allowing automatic labeling of new PRs, based on the modified files paths.

Below labels are supported and more can be added later:

  • 'target/*'
  • 'target/imagebuilder'
  • 'kernel'
  • 'core packages'
  • 'build/scripts/tools'
  • 'toolchain'
  • 'GitHub/CI'

For more information: https://github.com/marketplace/actions/labeler

pepe2k avatar Jun 20 '22 14:06 pepe2k

Looks good, can we label it based on branch, too?

aparcar avatar Jun 20 '22 14:06 aparcar

Looks good, can we label it based on branch, too?

Not with this one, it only analyzes paths of modified files. But what exactly do you have in mind, labels for target version the PR is for?

pepe2k avatar Jun 20 '22 14:06 pepe2k

I also add this idea... but my idea was to create a bot with nodejs and host it instead of using actions The idea was having more control and a bot assigning label was better than an actions... (and also that would permit us to introduce useful command like /merged that would automatically flag the pr as merged and provide the hash in the git repo)

Ansuel avatar Jun 21 '22 16:06 Ansuel

Not with this one, it only analyzes paths of modified files. But what exactly do you have in mind, labels for target version the PR is for?

Think he was referring to pr specific to openwrt release

Ansuel avatar Jun 21 '22 16:06 Ansuel

@Ansuel I'm fine with anything else but this solution exists now so why not use it till we have something more sophisticated?

pepe2k avatar Jun 21 '22 20:06 pepe2k

@pepe2k sure i wanted to put some comments just to get some feedback of my idea... (ideally the bot should be hosted on github servers)

But yhea ok for me for using actions to autolabel :D

Ansuel avatar Jun 21 '22 20:06 Ansuel

sure i wanted to put some comments just to get some feedback of my idea... (ideally the bot should be hosted on github servers)

Do you have a working PoC or some similar solution available somewhere to look at?

pepe2k avatar Jun 22 '22 11:06 pepe2k

@pepe2k today i wasted some time with a PoC... (don't judge the following link ahahahah)

https://github.com/Ansuel/test-openwrt-webook The bot is currently running on my local system.

Anyway in practice my solution is a custom github app. Needs to be hosted but permit more flexibility than simple actions...

Current implementation assume an issue with for example

ath79: something

where ath79 is parsed with a regex (everything before : is used), we search if a label exist with that and assign it.

I also tested command. If you send a comment with /thanks the bot send a specific message.

Tell me what do you think about this.

(currently this is only implemented for issue but can be expanded and it's only a PoC)

Ansuel avatar Jun 22 '22 18:06 Ansuel

(i'm turning off the local server... put here a message and i will reopen it ASAP)

Ansuel avatar Jun 22 '22 22:06 Ansuel

New on this? @aparcar @pepe2k Is the bot hosting viable? The implementation is very simple and much more flexible than a CI action

Ansuel avatar Jun 29 '22 17:06 Ansuel

@Ansuel

Needs to be hosted but permit more flexibility than simple actions...

And needs to be hosted/maintained by someone. We should limit amount of additional services and work around the project and focus on important parts.

Current implementation assume an issue with for example

ath79: something

where ath79 is parsed with a regex (everything before : is used), we search if a label exist with that and assign it.

I'm focusing on PRs here only, not issues which are much more complicated and might require a sophisticated solution.

I think this might not be reliable. You assume contributors will follow our patch submitting guide and provide correct prefixes - believe me, that's not always true. Solution based on a paths modified by commit/s in a selected PR is just simple and human-error prone.

I also think a simple regex on PR/issue title for labeling can also be done with actions.

Cheers, Piotr

pepe2k avatar Jun 29 '22 20:06 pepe2k

And needs to be hosted/maintained by someone. We should limit amount of additional services and work around the project and focus on important parts.

This is my concern... Anyway the bot is so easy that once done it doesn't require that much changes...

I'm focusing on PRs here only, not issues which are much more complicated and might require a sophisticated solution.

The example was with issue just because it was easier to create tons of issue to develop the bot. But it was just a proposal of a IMHO better solution

Ansuel avatar Jun 29 '22 20:06 Ansuel

@Ansuel

This is my concern... Anyway the bot is so easy that once done it doesn't require that much changes...

Whenever I hear something like this, I run away :smirk:

But it was just a proposal of a IMHO better solution

I still fail to understand and see why it's better?

Cheers, Piotr

pepe2k avatar Jun 29 '22 20:06 pepe2k

I still fail to understand and see why it's better?

  • Can be extended (command to automate some process like invalid pr/issue., invalid Sob, add relevant commit hash merged in master...)
  • Can also be used with issue
  • Check tags relevant to branch
  • A bot that adds label instead of an action/a labeller from marketplace

Ansuel avatar Jun 29 '22 21:06 Ansuel

This adds GitHub CI action which makes use of 'Labeler', allowing automatic labeling of new PRs, based on the modified files paths.

LGTM as an immediate solution.

My gripe of such solution is, that we need to have this file included in our source code repository, which is going to pollute Git log history with a commits which are not related to the source code and each such commit/modification then triggers a build pipeline on our buildbot and build firmware images for all targets (~24 hours), so wasting a lot of resources.

Well, this is probably just an issue with our workflow and tooling around, so we should probably just start ignoring sole commits to a predefined directories like .github on buildbot.

And needs to be hosted/maintained by someone.

FYI you can use scheduled GitHub Action for that purpose, which is essentially "serverless" cron job. I'm for example using such feature to self-assign patches on our patchwork, it's running every two hours and doesn't need any additional infrastructure.

You assume contributors will follow our patch submitting guide and provide correct prefixes - believe me, that's not always true.

You can enforce such formalities with GH Actions.

I'm focusing on PRs here only, not issues which are much more complicated and might require a sophisticated solution.

Well, on GitHub every pull request is an issue, but not every issue is a pull request, so they share a lot. Using templates to encourage useful issues and pull requests should help a lot as well.

BTW GitLab is using machine learning for a classification based on a issue content.

ynezz avatar Jun 30 '22 04:06 ynezz

Also OK for me as a solution for now but IMHO we should use specialized tools instead of a simple labeler :D

Ansuel avatar Jul 04 '22 15:07 Ansuel

@pepe2k any news on this?

Ansuel avatar Sep 05 '22 11:09 Ansuel

@Ansuel I will rebase and look again into this in next days, thanks for reminder!

pepe2k avatar Sep 07 '22 20:09 pepe2k

Looks good. I'd merge this

aparcar avatar Sep 13 '22 15:09 aparcar

@aparcar done. @ynezz thanks for all your comments,so far, I failed to find time to address them but will try again, this time harder (at least wasting buildbots resources is something I would like to look at)! :)

Hope it will do the job until we have something better

Cheers, Piotr

pepe2k avatar Sep 13 '22 19:09 pepe2k