[wp-meta] [Making WordPress.org] #6538: wporg-markdown importer - Support GitHub branches not named `master`
Making WordPress.org
noreply at wordpress.org
Wed Oct 12 12:49:47 UTC 2022
#6538: wporg-markdown importer - Support GitHub branches not named `master`
--------------------------------+--------------------
Reporter: netweb | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone:
Component: WordPress.org Site | Keywords:
--------------------------------+--------------------
Currently the `get_markdown_edit_link()` function hard codes the GitHub
`edit` link to `master`:
([https://github.com/WordPress/wordpress.org/blob/trunk/wordpress.org/public_html
/wp-content/plugins/wporg-markdown/inc/class-editor.php#L178-L190 Source])
{{{
if ( 'github.com' !== parse_url( $markdown_source,
PHP_URL_HOST )
|| false !== stripos( $markdown_source,
'/edit/master/' ) ) {
return $markdown_source;
}
$markdown_source = str_replace( '/blob/master/',
'/edit/master/', $markdown_source );
}}}
Discovered after merging https://github.com/WordPress/WordPress-
Documentation-Style-Guide/pull/20 where the default branch is `main`,
prior to merging the above PR the GitHub "edit" URL on pages were in the
form:
- `https://github.com/WordPress/WordPress-Documentation-Style-
Guide/edit/master/docs/2-general-guidelines/6-facts-claims.md`
- (Via the https://make.wordpress.org/docs/style-guide/general-
guidelines/facts-claims/ page)
The above URL format 404s as the `master` branch no longer exists on
GitHub
The new "edit" URL on pages is:
- `https://github.com/WordPress/WordPress-Documentation-Style-
Guide/main/docs/2-general-guidelines/6-facts-claims.md`
- (Via the https://make.wordpress.org/docs/style-guide/general-
guidelines/facts-claims/ page)
And as such the URL doesn't include `/edit/main`, just `/main`, so the URL
opens correctly just not in the previous "edit" mode.
My suggestion would be to update the above function to account for common
dotorg repo branch names used: `trunk`, `main`, and `master`
--
Ticket URL: <https://meta.trac.wordpress.org/ticket/6538>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org
More information about the wp-meta
mailing list