Making WordPress.org


Ignore:
Timestamp:
10/27/2020 02:41:36 AM (6 years ago)
Author:
dd32
Message:

Theme Directory: Add a callback to an experimental theme-review workflow.

Props dufresnesteven.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r10243 r10410  
    11<?php
     2use WordPressdotorg\Theme_Directory\Lib\GitHub;
    23
    34/**
    … …  
    323324
    324325                do_action( 'theme_upload', $this->theme, $this->theme_post );
     326
     327                // Initiate a GitHub actions run for the theme.
     328                $this->trigger_e2e_run( $ticket_id );
    325329
    326330                // Success!
    … …  
    948952        }
    949953
     954        /**
     955         * Triggers a GitHub actions run for the upload.
     956         */
     957        public function trigger_e2e_run( $ticket_id ) {
     958                $api = GitHub::api(
     959                        '/repos/' . WPORG_THEMES_E2E_REPO . '/dispatches',
     960                        json_encode([
     961                                'event_type'     => $this->theme->display( 'Name' ),
     962                                'client_payload' => [
     963                                        'theme_slug'       => $this->theme_slug,
     964                                        'theme_zip'        => "https://wordpress.org/themes/download/{$this->theme_slug}.{$this->theme->display( 'Version' )}.zip?nostats=1",
     965                                        'accessible_ready' => in_array( 'accessibility-ready', $this->theme->get( 'Tags' ) ),
     966                                        'trac_ticket_id'   => $ticket_id,
     967                                ],
     968                        ])
     969                );
     970       
     971                // Upon failure a message is returned, success returns nothing.
     972                return empty( $api );
     973        }
     974
    950975        // Helper
    951976
Note: See TracChangeset for help on using the changeset viewer.