Changeset 9539
- Timestamp:
- 02/26/2020 06:13:24 AM (5 years ago)
- 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
r9534 r9539 153 153 return new Trac( GH_PRBOT_USER, GH_PRBOT_PASS, $trac_uri ); 154 154 } 155 156 /** 157 * Formats a PR description for usage on Trac. 158 * 159 * This strips out HTML comments and standard boilerplate text. 160 * 161 * @param object $pr_data PR Data. 162 * @return string Stripped down PR Description 163 */ 164 function format_pr_desc_for_trac_comment( $pr_data ) { 165 $desc = trim( $pr_data->body ); 166 167 // Remove HTML comments 168 $desc = preg_replace( '#<!--.+?-->#', '', $desc ); 169 170 // Remove the final line if it matches the specific boilerplate format. 171 $desc = preg_replace( "#---\r?\n\*\*.+\*\*$#", '', $desc ); 172 173 return trim( $desc ); 174 } -
sites/trunk/api.wordpress.org/public_html/dotorg/trac/pr/webhook.php
r9532 r9539 80 80 $trac = get_trac_instance( $pr_data->trac_ticket[0] ); 81 81 82 $pr_description = format_pr_desc_for_trac_comment( $pr_data ); 83 82 84 $trac->update( 83 85 $pr_data->trac_ticket[1], … … 85 87 "on [https://github.com/{$pr_repo}/ {$pr_repo}] " . 86 88 "by [{$pr_data->user->url} {$pr_data->user->name}].''" . 87 ( trim( $pr_data->body ) ? "\n{$pr_data->body}" : '' ),89 ( $pr_description ? "\n{$pr_description}" : '' ), 88 90 [], // Attributes changed 89 91 true // Notify
Note: See TracChangeset
for help on using the changeset viewer.