feat: linkify issue/pr reference numbers with proper markdown links - #48
Open
yCodeTech wants to merge 3 commits into
Open
Conversation
- Added `linkifyReferences` function to orchestrate all other intermediate functions in order to find issue/pr references, resolve the correct GitHub URLs and linkify them into proper markdown links in the new changelog section. Also added its function call to the `formatPRDescription` function. - Added `findBareReferences` function to find all bare issue or pr references that aren't already linked within specified text, and collect the unique numbers. - Added `findClosingKeywordReferences` utils function in the new utils script to find all bare references that are preceded with closing keywords like close(s/d), fix(es/ed), resolve(s/d), and collect the unique numbers. - Added `resolveClosingKeywordReferenceUrl` function to resolve the closing keyword issue reference URL. It only needs to construct the URL from the context and reference number without an API call since closing keywords always references issues. - Added `resolveBareReferenceUrl` function to resolve the bare reference URL, using the GitHub REST API to lookup the reference number and determine whether it's an issue or a pull request, and returns the correct URL, or an empty string if errors occurred. - Updated the changelog CI permissions to include reading issues. - Updated the "Sparse checkout exclusion script" step in the CI to also checkout the utils script. - Updated the "Copy changelog script" step in the CI to also copy the utils script to a temp file so it can be imported properly in the temp update-changelog file.
- Moved `TYPE_TO_SECTION` and `INCLUDED_TYPES` const variables from the update-changelog script to the utils script for better organisation of cross-file variables. Updated the references in the update-changelog script to use the `utils` namespace import. - Changed the `update-changelog` import to `utils` import in the check-changelog-exclusions script. - Updated the "Sparse checkout exclusion script" step name to "Sparse checkout scripts for PR exclusion checks" in the changelog CI so that it doesn't sound like it's excluding the specified files. - Removed the update-changelog script from the sparse checkout step in the changelog CI.
… function - Moved the `ALL_COMMIT_TYPES` and `typeRegex` global variables to be local variables in the `checkExclusions` function of the `check-changelog-exclusions` script. This is because they're not used in any other function so they don't need to be global variables. Also made the `ALL_COMMIT_TYPES` all lowercase. All uppercase should be kept for global variables/constants.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
linkifyReferencesfunction to orchestrate all other intermediate functions in order to find issue/pr references, resolve the correct GitHub URLs and linkify them into proper markdown links in the new changelog section. Also added its function call to theformatPRDescriptionfunction.Added
findBareReferencesfunction to find all bare issue or pr references that aren't already linked within specified text, and collect the unique numbers.Added
findClosingKeywordReferencesutils function in the new utils script to find all bare references that are preceded with closing keywords like close(s/d), fix(es/ed), resolve(s/d), and collect the unique numbers.Added
resolveClosingKeywordReferenceUrlfunction to resolve the closing keyword issue reference URL. It only needs to construct the URL from the context and reference number without an API call since closing keywords always references issues.Added
resolveBareReferenceUrlfunction to resolve the bare reference URL, using the GitHub REST API to lookup the reference number and determine whether it's an issue or a pull request, and returns the correct URL, or an empty string if errors occurred.Updated the changelog CI permissions to include reading issues.
Updated the "Sparse checkout exclusion script" step in the CI to also checkout the utils script.
Updated the "Copy changelog script" step in the CI to also copy the utils script to a temp file so it can be imported properly in the temp update-changelog file.