`uses` local repository path behavior

I created a repository with action and wanted to use the action on the repository itself.
In .github/actions/myaction.yaml I used 

uses: .

to run from the root of the repo which didn’t work. And failed with error:

- Your workflow file was invalid: The pipeline is not valid. .github/workflows/lint.yml (Line: 26, Col: 15): Expected format {org}/{repo}[/path]@ref. Actual '.',Input string was not in a correct format.

I managed to fix it by using

uses: ./

instead.

Is this expected behavior? I would assume that the single . (dot) would have the same meaning in this context as ./

Hi @matoous,

In your repository, you used the incorrect file structure and syntax for actions:

  1. Gernerally, you should add a folder for each action, and put the action.yml file in this folder. In you case, you can set it like as .github/actions/my-action/action.yaml .

  2. When you call a action in the workflow, the you should use the complete path of the action directory, in you case, it should be like as this

    • uses: ./.github/actions/my-action

You can get more details from here:

1 Like

Hi! What I meant happens in this repo: https://github.com/matoous/golangci-lint-action

E.g. the repository itself is a action - a linter and I would like to always run the latest version of it on itself so my initial thought was to just run from the root as explained previously. What other solution would be viable in this place?

Hi @matoous ,

Please try the syntax

uses: <org>/<repos>@<ref>

OR

uses: ./

Below is a summary of the possible syntax and their results:

1) uses: <org>/<repos>@<ref>    ---- work

2) uses: ./                                         ---- work

3) uses: <org>/<repos>                 ---- invalid

4) uses: .                                           ---- invalid

In syntax (1) the <ref> can be a specific branch or a specific version of the action.

1 Like