I am learning Github actions and getting an error when I use a composite action.
Here is my github workflow file:
- name: Step1
id: action-file
uses: ./.github/action/module
with:
my_name: "PythonTest"
And Here is action file:
using: composite
steps:
- name: Step1
run: print ("Hello" + ${{ inputs.my_name }})
shell: python
I am getting the below error when I execute:
Warning: Unexpected input(s) 'my_name', valid inputs are ['']
Run ./.github/action/module
Traceback (most recent call last):
File "/home/runner/work/_temp/51be3e25-aa9b-4e7b-a9ff-80070e4f7754.py", line 1, in <module>
print ("Hello" + PythonTest)
NameError: name 'PythonTest' is not defined
YAML is parsing out your ""
. As you can see in the error, PythonTest
is passed as a symbol, not a string. You need to modify your template in order to accommodate for this:
using: composite
steps:
- name: Step1
run: print ("Hello" + "${{ inputs.my_name }}")
shell: python
Whatever is between the ${{}}
template will be replaced, and your test will output "HelloPythonTest"