I'm defining a github action script that's referencing to another yaml file, hoping to put the configuration into a more organised way.
Here is my job file, named as deploy.yml
in the path of ./.github/workflows/
, where the first .
is the root folder of my project.
....
jobs:
UnitTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/workflows/unittest.yml
In the same ./.github/workflows/
folder, I created another file called unittest.yml
as below:
name: "UnitTest"
description: "Perform Unit Test"
runs:
# using: "composite"
- name: Dependency
run: |
echo "Dependency setup commands go here"
- name: UnitTest
run: make test.unit
However, when I tried to test the script locally using act with command act --secret-file .secrets --container-architecture linux/amd64
, I received the following error:
[Deploy/UnitTest] ✅ Success - Main actions/checkout@v3
[Deploy/UnitTest] ⭐ Run Main ./.github/workflows/unittest.yml
[Deploy/UnitTest] ❌ Failure - Main ./.github/workflows/unittest.yml
[Deploy/UnitTest] file does not exist
[Deploy/UnitTest] Job failed
I have tried to put just the file name unittest.yml
or ./unittest.yml
or myrepo_name/.github/workflows/unittest.yml
or put the file into a subfolder like step 2 of this document illustrated, but all no luck.
Based on examples of runs for composition actions, I would imagine this should work.
Would anyone please advise?
P.S. You might have noticed the commented line of using: "composite"
in the unittest.yml
. If I uncomment the line, I'll receive error:
Error: yaml: line 3: did not find expected key