Using a relative link as directed (https://help.github.com/articles/about-readmes/#relative-links-and-image-paths-in-readme-files) in a PULL_REQUEST_TEMPLATE.md does not relatively link correctly.
When viewed in an actual PR:
[CONTRIBUTING.md](/.github/CONTRIBUTING.md)
routes to: https://github.com/.github/CONTRIBUTING.md
.
[CONTRIBUTING.md](.github/CONTRIBUTING.md)
[CONTRIBUTING.md](./.github/CONTRIBUTING.md)
route to:
https://github.com/owner/repo/compare/.github/CONTRIBUTING.md
instead of https://github.com/owner/repo/.github/CONTRIBUTING.md
.
Changing to ../
to go up a level would work for PRs, but would break the link when viewed in the GitHub UI.
Clicking the link as viewed on GitHub works: https://github.com/fs-webdev/fs-dialog/blob/master/.github/PULL_REQUEST_TEMPLATE.md, just not inside a PR.
(I feel like this used to work in 2017)
What is the correct way to have the relative link function as expected in both cases?
Pull request templates allow your organizations to have a default text when you create a pull request on GitHub. It is quite useful to make sure to follow a standard process for every pull request and to have a to-do list for the author to check before requesting a review.
Pull requests let you tell others about changes you've pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.
Once the repository maintainer has approved a pull request, the developer's new updates in the forked repository are merged with the main project repository. The product is then updated with the new feature or bug fix, and can now be viewed by end users.
Unfortunately, the given implementation seems to consider only the current URL instead of the actual file path in the repository.
The same limitation can be noted when creating issues (through e.g.:
https://github.com/owner/repo/issues/new
):
[CONTRIBUTING.md](.github/CONTRIBUTING.md)
->
https://github.com/owner/repo/issues/.github/CONTRIBUTING.md
I only managed to make the relative link work by specifying the full URL
path (including the leading /
):
[CONTRIBUTING.md](/owner/repo/.github/CONTRIBUTING.md)
->
https://github.com/owner/repo/.github/CONTRIBUTING.md
With that said, the abstraction can only go up to the URL host (i.e.:
https://github.com
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With