diff --git a/.github/workflows/hello.yaml b/.github/workflows/hello.yaml new file mode 100644 index 00000000..95fb5035 --- /dev/null +++ b/.github/workflows/hello.yaml @@ -0,0 +1,30 @@ +name: Run Hello World with Dynamic Name + +on: + push: + branches: + - main + workflow_dispatch: + inputs: + personName: + description: 'Person Name' + required: true # Making it required to ensure a name is always provided + default: 'John' + +jobs: + run-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Run Hello World script with dynamic name + env: + PERSON_NAME: ${{ github.event.inputs.personName }} + run: python hello.py diff --git a/.gitignore b/.gitignore index ddc2bd11..f3a7af63 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ __pycache__/ *.so *~ venv/ - # due to using nox and pytest .nox .cache diff --git a/hello.py b/hello.py new file mode 100644 index 00000000..4a635f27 --- /dev/null +++ b/hello.py @@ -0,0 +1,8 @@ +# hello_world.py +import os + +# Get the name from the environment variable +name = os.getenv('PERSON_NAME', 'John') # Default name is 'John' if not provided + +# Print the greeting message +print(f"Hello, World! {name}") \ No newline at end of file