如何获取GitHub Action的最新版本?

huangapple go评论106阅读模式
英文:

How to get the latest version of github action?

问题

我在想是否有一种可靠的方法来获取GitHub操作的最新版本。我找到了建议使用main或master分支的建议,但这对我并不总是有效。此外,一些操作的分支名称与main或master不同。

我尝试在我的GitHub工作流中使用actions/checkout@latest操作,但它不起作用。这与我用来安装Node.js包的最新版本的语法相同,但似乎不适用于GitHub操作。

英文:

I am wondering if there is a reliable way to get the latest version of a GitHub action. I found a suggestion to use the main or master branch, but this does not always work for me. Additionally, some actions have different branch names than main or master.

I have tried to use the actions/checkout@latest action in my GitHub workflow, but it is not working. This is the same syntax that I use to install the latest version of a Node.js package, but it does not seem to work for GitHub actions.

答案1

得分: 1

目前没有可靠的方法来实现这一点。设置标签和分支的责任在于操作的所有者,尽管有关如何执行此操作的指导,但并没有强制执行。理论上,操作的所有者可以发布一个名为latest的标签,然后这将起作用,但不幸的是,没有人这样做。

保持最新的“最佳”方法是使用 Dependabot 或 RenovateBot,在操作的新版本发布时自动提交拉取请求。

在存储库中添加一个.github/dependabot.yml文件:

version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/" # 包清单的位置
    schedule:
      interval: "weekly"

然后,至少在发布新版本时您会收到一个拉取请求。

英文:

There currently is no reliable way to achieve this. It's up to the owner of the action to setup tags and branches and though there is guidance on how to do this, it's not enforced. In theory an action owner could publish a tag called latest and that would then work, but unfortunately, nobody does this.

The "best" way to stay current is to use Dependabot or RenovateBot to automatically submit a pull-request when a new version of an action is published.

Add a .github/dependabot.yml file to the repository:

version: 2
updates:
  - package-ecosystem: "github-actions"
    directory: "/" # Location of package manifests
    schedule:
      interval: "weekly"

Then at least you get a PR whenever a new version is released.

huangapple
  • 本文由 发表于 2023年8月9日 14:05:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76864975-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定