-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Placeholder for hash of current commit in README.md file #1363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would like to second this request, and add the following use case: As the author of a paper whose drafts I share publicaly on github, I would like to include a |
This would be really useful. And I also would like to reference past commits in a similar way. Example: |
This would be super handy for commit-based package management, like for example, in Bazel WORKSPACEs |
This would be useful for clojure deps.edn projects, where dependency information can be shared as {:git/sha "abcdefg"} |
Yes please. I got here from Google, looking for this feature. Referencing past commits with relative references would be a nice feature in commit messages. The problem with SHA references is that once you rebase the branch (perhaps after every PR depending on GitHub workflow), the SHA changes. This is mostly okay as long as we can link to commits with an orphaned SHA, but I'm not sure if that's alway the case with the GitHub implementation of rebasing. |
I would also like to see this feature for my Clojure/script and babashka projects where it's common to use the GitHub sha as part of the dependencies information. Example: Also a way of referring to the sha of a specified tag Example: |
It can really help to show the exact version for the snapshot builds (from JitPack or others similar), conveniently for the user. |
This would be great for github-actions as you can go to a specific version and just grab the full SHA from readme. Trusting tags is a bit unsafe sometimes since you have no control over it but pinning a github-action to a specific has a bigger guarantee. |
Stale issue message |
More like ignored issue |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Bump then |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
bumpers |
Preface
To link to specific file in README.md we have some several ways (#1, #2):
1. Link to latest version of file in specific branch:
2. Permanent link to specific version (commit) of file:
We have to know SHA of commit, so it is not possible to place this link in README.me in the same commit (we don't know what hash will be generated).
3. Relative link do file.
Markdown:
This will be dynamically replaced with (rendered):
Feature request
I would like to be able to specify a placeholder that would be automatically replaced with the current hash of current commit.
For example.
Markdown:
Rendered:
Related issue/feature
I know that there was related feature request #913 (#472) with placeholder for branch name. And as I understood this isn't easy to implement.
But this issue refers to SHA of commit, not branch name. This feature looks looks similar to relative link do file (the 3. way to create a link).
Rendering from/to exists:
Maybe rendering from/to is easier to implement than rendering branch name:
Motivation for requesting feature
Primary motivation
I'm looking for a way to show demo of my HTML/JS code, separately for every commit (not only for last version of file).
I've researched several ways here:
https://stackoverflow.com/questions/62740362/how-to-show-demo-with-html-and-javascript-d3-js-on-github-for-every-commit
It seems that closest to success is using external service for serving HTML directly from GitHub file. There are several services of that kind: HtmlPreview, RawGit, raw.githack.com.
Example link for preview of HTML file (specific version of file):
You can see I need hash to create this link (I want to place this link in README.md).
If the placeholder existed I could easily create link.
Markdown:
Rendered:
With this you can see demo for every historical commit.
Secondary motivation
In this related issue #913 motivation is sending branch name to external service. If he could send hash of commit, maybe he can easily get branch name in external tool (there you usually have access to the entire Git repository) and it could be sufficient to archive his goal.
Another variant of feature request
If this is hard to implement I got an idea that can be easier to implement: relative link as text.
If this:
can be rendered to:
and more specifically (in view) to:
Maybe this can be rendered in view just as plain text?
For example placeholder:
{raw-url}
.With this I could build this URL:
That will be rendered as:
And this will also solve my problem.
(Bad) shortcut for implementing another variant
I've got another idea (that doesn't seem good).
If this / is rendered on view like this:
Maybe it would be enough to support custom
<base>
tag.For example configuring this in README.md:
And markdown with relative link:
will be rendered as:
But clicking on it redirect to:
Instead of standard this:
Supporting
<base>
tag was mentioned here #84 (comment), but I think the same it is not good idea (Because what about the rest of the relative links? It will be broken).The text was updated successfully, but these errors were encountered: