是否有 link 到 GitHub 用于从标记有最新版本的 repo 下载文件?

Is there a link to GitHub for downloading a file from the repo tagged with the latest release?

问题 Is there a link to GitHub for downloading a file in the latest release of a repository? 为您提供了获取 GitHub 存储库中最新版本的任何文件所需的全部信息。

同理,我想知道您是否可以 link 到存储库中(不在发行版中)标记有最新版本的文件?

所以不用

https://github.com/USER/PROJECT/blob/COMMIT_HASH/myfile.json

我想要类似

的东西
https://github.com/USER/PROJECT/blob/releases/lates/myfile.json

选项当然是分两步做,用releases api然后搞定,不过不知道有没有单行的

but I wonder if there is a one-liner.

据我所知没有任何人:您仍然需要获取最新版本的 SHA1,然后才能提供文件 URL。
问题是:最终结果(文件URL)将是静态的,如果有新版本,您将不得不重新计算URL。

所以你可能会根据 latest tag 来解释一些东西,比如:

curl https://github.com/USER/PROJECT/blob/$(curl --silent "https://api.github.com/repos//releases/latest" | jq -r .tag_name)/myfile.json