mcoolive
mcoolive

Reputation: 4205

How to express a version range for Github Action dependency

In a GitHub workflow, I may use a versioned Github Action. The documentation states:

We strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA, or Docker tag number. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update.

As far I know, the version can be: a branch, ref, or a commit SHA1.

Is it possible to express more constraints such as a version range? An imaginary syntax:

jobs:
  my_job:
    steps:
      - name: My action
        uses: myAction@[1.1, 1.234]

It would means "use MyAction with a version between 1.1 and 1.234". Is there a way to express that kind of version constraints?

Upvotes: 3

Views: 1240

Answers (1)

atline
atline

Reputation: 31644

I don't think it's possible as in theory looks not.

In github actions, every customized action's syntax is githubuser/repository.

It represents for a real github repo: E.g.actions/setup-node as https://github.com/actions/setup-node

The github actions engine surely need to download the source code from these repository, and use a git concept (Hash, commit, branch, tag) to find the correct source to run the action. If we allow a range, then really don't know which commit of action's source code should be used.

Upvotes: 3

Related Questions