diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f971417a..b121318ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ _None_ ### Bug Fixes -_None_ +- Fix issue with post-processing of PR urls in the body of GitHub releases created via `create_github_release` [#610] ### Internal Changes diff --git a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_github_release_action.rb b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_github_release_action.rb index 3eb8c2711..00e037a20 100644 --- a/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_github_release_action.rb +++ b/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_github_release_action.rb @@ -9,8 +9,10 @@ def self.run(params) version = params[:version] assets = params[:release_assets] release_notes = params[:release_notes_file_path].nil? ? '' : File.read(params[:release_notes_file_path]) - # Replace full URLS to PRs/Issues with shorthand, because GitHub does not render them properly otherwise. - release_notes.gsub!(%r{https://github.com/([^/]*/[^/]*)/(pulls?|issues?)/([0-9]*)}, '\1#\3') + # Replace full URLs to PRs/Issues that are in `[https://some-url]` brackets with shorthand, because GitHub does not render them properly otherwise. + # That syntax is sometimes used by devs in `RELEASE-NOTES.txt` when pointing to a PR to another repo (e.g. Gutenberg PR from WP repo). + # We should NOT transform URLs to PRs/Issues that are in `[text](url)` form (those are valid), only the ones directly in `[]` brackets. + release_notes.gsub!(%r{\[https://github.com/([^/]*/[^/]*)/(pulls?|issues?)/([0-9]*)\]}, '[\1#\3]') prerelease = params[:prerelease] is_draft = params[:is_draft]