jv-k
jv-k

Reputation: 710

Using the latest version of a GitHub Action

Is it possible to use the latest version of a published GitHub Action from the Marketplace in a workflow?

This would be nice if it was somehow possible:

      - name: "TODO to Issue"
        uses: "alstr/todo-to-issue-action@latest"

For example, with a npm package you can do npm install node@latest to use the latest version of that package.

On an action's page, when you click on "Use latest version", it shows the following dialogue, where the version number is hard-coded:

example action

Upvotes: 20

Views: 9362

Answers (2)

taoliujun
taoliujun

Reputation: 131

It is hard to choose @tag or @master. If you select @tag, you will not be able to use the new features and bug fixes for that actions. If you select @master, you will worry about the latest code not being compatible with your earlier logic.

I'm an actions author, and created a major version tag v1. When new code is released, the new tag v1.0.x is created and I updated tag v1 with the new commit sha. In the Marketplace README.md, users are reminded to use @v1 to use compatible new features in a timely manner, and to use @v1.0.x to seek stability.

In fact, some well-known actions such as actions/checkout do just that. You see, the latest commit sha of tag v4 is always the same as the latest v4.x.x.

Upvotes: 2

Matteo
Matteo

Reputation: 39370

The syntax is {owner}/{repo}@{ref} so you can point to the master branch as follow:

      - name: "TODO to Issue"
        uses: "alstr/todo-to-issue-action@master"

BTW In case of a major update, any breaking changes could stop your workflow, so I would suggest to tag to a major version, for example @4:

      - name: "TODO to Issue"
        uses: "alstr/todo-to-issue-action@v4"

Upvotes: 11

Related Questions