Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Auto label PR's based on content#34

Merged
weaverryan merged 14 commits into
masterfrom
auto_label_prs
May 22, 2016
Merged

Auto label PR's based on content#34
weaverryan merged 14 commits into
masterfrom
auto_label_prs

Conversation

@weaverryan
Copy link
Copy Markdown
Contributor

Hi guys!

This finishes #29, after a few of us made big changes to the repository.

The functionality is best seen by looking at the AutLabelPRFromContentSubscriberTest.

This will only be used on symfony/symfony, not the docs.

I'm pretty confident this is solid. We just need approval that we for sure want this functionality :).

Ping @javiereguiluz

public function onPullRequest(GitHubEvent $event)
{
$data = $event->getData();
if ('opened' !== $action = $data['action']) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not allow edited as suggested by @webmozart?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a matter of adding it later - it could be really easy, i actually didn't check :)

@HeahDude
Copy link
Copy Markdown
Contributor

Great work! I was doing the same :) That was fast!

}

// the PR body usually indicates if this is a Bug, Feature, BC Break or Deprecation
if (preg_match('/\|\s*Bug fix\?\s*\|\s*yes\s*/', $prBody, $matches)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use /.../i to allow "Yes" as well

@javiereguiluz
Copy link
Copy Markdown
Contributor

@weaverryan thanks for finishing this and adding proper tests. I agree with the minor comments made by @wouterj, so this looks ready to me 👍

Regarding your question: "do we want this functionality?" Today we have this functionality enabled in the repo ... but it's made by hand instead by this bot. I think it's useful because Symfony's backlog is huge and these labels allow us to quickly filter by topic (bug/feature/deprecation) and by component.

@weaverryan weaverryan merged commit af3bb2e into master May 22, 2016
@weaverryan
Copy link
Copy Markdown
Contributor Author

This is now active on the core repository! So, let's see how Carson performs :)

if (preg_match_all('/\[(?P<labels>.+)\]/U', $prTitle, $matches)) {
// creates a key=>val array, but the key is lowercased
$validLabels = array_combine(
array_map(function($s) {
Copy link
Copy Markdown
Contributor

@sstok sstok May 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified to array_map('strtolower', $this->getValidLabels()), no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants