I'm trying to pass a user input from a Github Action to a python script and I can't seem to get it working properly.
Here is my yml:
name: Test Python Input
on:
workflow_dispatch:
inputs:
myInput:
description: 'User Input Here'
required: true
jobs:
run-python-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Setup Python
uses: actions/setup-python@v2.2.2
with:
python-version: 3.8
- name: Execute Test Script
run: |
echo "Store: ${{ github.event.inputs.myInput }}"
INPUT_STORE=${{ github.event.inputs.myInput }} python3 test.py
And here is my test.py:
import os
inputvariable = os.environ['INPUT_MYINPUT']
print(inputvariable)
print('Hello World!')
What am I doing wrong here and how can I put Python to print out the user input variable?
