Reputation: 982
I have defined a composite custom action in my repository at .github/actions/my-custom-action/action.yml, and I want to use it in a workflow job that runs on a Windows self-hosted runner.
To do that, I am specifying a relative path in my workflow file:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Execute custom action
uses: ./.github/actions/my-custom-action/
However, when the job is executed on a self hosted runner in a Windows machine, I get the following error:
C:\actions-runner\_work\repo-name\repo-name\./.github/actions/deploySumex/action.yml: (Line: 31, Col: 11, Idx: 660) - (Line: 31, Col: 11, Idx: 660): Mapping values are not allowed in this context.
If I change the relative path to:
uses: .\.github\actions\my-custom-action\
or
uses: .github\actions\my-custom-action\
or using the full path:
uses: C:\github-runner\_work\repo-name\repo-name\.github\actions\my-custom-action\
I get the following error right after I commit the changes:
the 'uses' attribute must be a path, a Docker image, or owner/repo@ref
My repository is private so I can not use the sintax for actions in a subdirectory of a public repository
uses: {owner}/{repo}/{path}@{ref}
Could you help me figure out how to use my composite custom action in a Windows self-hosted runner?
Update As requested by GuiFalourd, this is my custom action YAML file: name: "Composite action Test"
runs:
using: "composite"
steps:
- name: step 1
run: |
Write-Host "Hello"
- name: step 2
run: |
Write-Host "world"
Upvotes: 0
Views: 2224
Reputation: 982
GuiFalourd was right on his comment, the problem was not in the way I was setting the path in the caller job. The problem was in the composite YAML action. It seems to be related to the use of double quotes. I refactored my YAML, and now it's working
name: "Hello World"
description: "Greet someone"
runs:
using: "composite"
steps:
- run: Write-host 'Hello world'
shell: powershell
Now I´m using single quotes in
run: Write-host 'Hello world'
I also needed to add a Shell
shell: powershell
Upvotes: 0