github-tools / github

A higher-level wrapper around the Github API. Intended for the browser.
BSD 3-Clause "New" or "Revised" License
3.6k stars 755 forks source link

How to tag a gist? #610

Closed cyberbiont closed 4 years ago

cyberbiont commented 4 years ago

One can install Github gist as project dependency with npm, using the following syntax (from official npm-install documentation): npm install gist:[<githubname>/]<gistID>[#<commit-ish>|#semver:<semver>]

But I can see no possibility to add the release tag to gist on Github (like you can do it with regular repository via 'releases' tab). So, when I change something in my gist, I cannot get it updated in my project, unless I clone it locally, tag the new commit and then push tags to the remote. But this process kinda defeats the ease of use, which is the gist's main advantage.

DanielRuf commented 4 years ago

This repository is not directly affiliated with github.com or its platform. This project is an API wrapper for JavaScript.

Please contact the support of github.com.

DanielRuf commented 4 years ago

But I can see no possibility to add the release tag to gist on Github (like you can do it with regular repository via 'releases' tab).

Afaik this is not supported. Gists are just the equivalent to pastebin entries. Plain syntax highlighted code with live view, revisions and comments. No tags, releases, branches, whatsoever.

DanielRuf commented 4 years ago

The npm docs are probably not correct or inconsistent.

https://github.com/npm/cli/blob/latest/docs/content/cli-commands/npm-install.md

Please file this issue there.

semver: is not possible. Only the commitish way. The second alphanumeric string is the revision.

revision 1: https://gist.github.com/DanielRuf/798e733786fcaf7faaf19eab704bf83a/e3c731c2a5702d3d1e08a7689d19aaaaef6f0e91

revision 2: https://gist.github.com/DanielRuf/798e733786fcaf7faaf19eab704bf83a/4b2da092df946f2f557bd9ed74a9cad9135da70b

You can install revision 1 with npm i gist:DanielRuf/798e733786fcaf7faaf19eab704bf83a#e3c731c2a5702d3d1e08a7689d19aaaaef6f0e91, so it is npm i gist:DanielRuf/gistID#revision

After this node node_modules/test/test.js outputs 1.

See also https://dev.edenspiekermann.com/2016/03/02/gists-as-npm-packages/