Making WordPress.org

Changeset 10728


Ignore:
Timestamp:
02/26/2021 07:19:50 AM (4 years ago)
Author:
dd32
Message:

Trac: GitHub PRs: Allow the Github webhook to provide a hint as to which trac it's destined for.

Example: https://api.wordpress.org/dotorg/trac/pr/webhook.php?trac=meta.

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

Legend:

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

    r10099 r10728  
    237237
    238238    // For now, we assume everything is destined for the Core Trac.
     239    $trac = 'core';
    239240    switch ( $pr->base->repo->full_name ) {
    240241        case 'WordPress/wordpress.org':
     
    242243            break;
    243244        case 'WordPress/wordpress-develop':
     245            $trac = 'core';
     246            break;
    244247        default:
    245             $trac = 'core';
     248            if ( defined( 'WEBHOOK_TRAC_HINT' ) && WEBHOOK_TRAC_HINT ) {
     249                $trac = WEBHOOK_TRAC_HINT;
     250            }
    246251            break;
    247252    }
  • sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php

    r10537 r10728  
    2828
    2929$payload = json_decode( file_get_contents( 'php://input' ) );
     30
     31if ( ! empty( $_GET['trac'] ) ) {
     32    define( 'WEBHOOK_TRAC_HINT', $_GET['trac'] );
     33}
    3034
    3135switch ( $_SERVER['HTTP_X_GITHUB_EVENT'] ) {
Note: See TracChangeset for help on using the changeset viewer.