Making WordPress.org

Changeset 9366


Ignore:
Timestamp:
12/19/2019 08:23:03 AM (5 years ago)
Author:
dd32
Message:

Trac: Github PRs: When a PR is first detected referencing a ticket, add an inline mention to Trac.

For now, this doesn't trigger email notifications.

See #4903.

Location:
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php

    r9340 r9366  
    66
    77require __DIR__ . '/functions.php';
     8require __DIR__ . '/class-trac.php';
    89
    910function verify_signature() {
     
    7576            );
    7677
    77             // TODO: Create a Trac ticket comment mentioning that the PR has been linked to the ticket.
     78            // Add a mention to the Trac Ticket.
     79            $trac_uri = 'https://' . $pr_data->trac_ticket[0] . '.trac.wordpress.org/login/rpc';
     80            $trac = new Trac( GH_PRBOT_USER, GH_PRBOT_PASS, $trac_uri );
     81
     82            $trac->update(
     83                $pr_data->trac_ticket[1],
     84                "''This ticket was mentioned in [{$pr_data->html_url} PR #{$pr_number}] " .
     85                    "on [https://github.com/{$pr_repo}/ {$pr_repo}] " .
     86                    "by [{$pr_data->user->url} {$pr_data->user->name}].''"
     87            );
    7888        }
    7989
Note: See TracChangeset for help on using the changeset viewer.