As you can see in your 2 screenshots, one is referring to the .github/workflows
directory (the one which worked), and the other to the .github/checks
directory (the one which didn't).
Short answer: If you change the workflow folder back to workflows
instead of checks
, it should work as expected.
Long answer: It seems there is a confusion between the syntax of two different concepts:
LOCAL ACTIONS
To access local actions (folders with action.yml
file) from your workflow, you need to use the actions/checkout
first, to allow it to access the other repository folders and files.
Example:
steps:
- uses: actions/checkout@v3 # Necessary to access local action
- name: Local Action Call
uses: ./.github/actions/local-action #path/to/action
I've made a POC here some time ago if you want to have a look.
REUSABLE WORKFLOWS
Now, if you want to use reusable workflows, the issue is different:
As with other workflow files, you locate reusable workflows in the
.github/workflows
directory of a repository. Subdirectories of the
workflows directory are not supported.
GitHub documentation reference
In that case, according to this other section from the documentation:
You reference reusable workflow files using one of the following
syntaxes:
{owner}/{repo}/.github/workflows/{filename}@{ref}
for reusable
workflows in public repositories.
./.github/workflows/{filename}
for reusable workflows in the same repository.
{ref}
can be a SHA, a release tag, or a branch name.
Example:
lint:
name: Call Lint
uses: ./.github/workflows/check-lint.yaml@{SHA/TAG/BRANCH}
or
lint:
name: Call Lint
uses: ./.github/workflows/check-lint.yaml
Here is another POC for the workflow call using this reusable workflow
CONCLUSION
It's like you were trying to call a reusable workflow as if it was a local action, which won't work as reusable workflows need to be located in the .github/workflows
directory.
Note that you could eventually add the @branch-name
at the end of the workflow call to be sure to use the workflow from the branch you want to test if the reusable workflow is already present on the default branch.
workflows
directory, you cannot do something likeworkflows/actions/my-file.yml
– Kerekes