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

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

How to get the latest version of github action?

问题

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

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

英文:

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.html
匿名

发表评论

匿名网友

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

确定