From 48cc4db08c4586dee386c094986912af1409ecf6 Mon Sep 17 00:00:00 2001 From: los0220 <62251722+los0220@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:28:09 +0100 Subject: [PATCH 1/2] fix: env variable passed to the python container action (#134) --- .../python-container-action/action.yaml | 9 +++++++-- .../python-container-action/entrypoint.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/06-authoring-actions/container-actions/python-container-action/action.yaml b/06-authoring-actions/container-actions/python-container-action/action.yaml index f4a38ee4..e454daad 100644 --- a/06-authoring-actions/container-actions/python-container-action/action.yaml +++ b/06-authoring-actions/container-actions/python-container-action/action.yaml @@ -14,5 +14,10 @@ runs: image: Dockerfile # Option B – use a pre-built image to avoid rebuilds: # image: docker://ghcr.io/your-org/hello-python-action:v1 - args: - - ${{ inputs.who-to-greet }} + + # Passing the input as an environmental variable + env: + INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }} + # Passing the value in the args list + # args: + # - ${{ inputs.who-to-greet }} diff --git a/06-authoring-actions/container-actions/python-container-action/entrypoint.py b/06-authoring-actions/container-actions/python-container-action/entrypoint.py index 579fec3a..55c2561f 100644 --- a/06-authoring-actions/container-actions/python-container-action/entrypoint.py +++ b/06-authoring-actions/container-actions/python-container-action/entrypoint.py @@ -2,11 +2,11 @@ import os, datetime as dt -# GitHub injects INPUT_WHO_TO_GREET based on the input name +# Read the input from the passed environmental variable name = os.getenv("INPUT_WHO_TO_GREET", "World") # Alternatively, you could read it from the args list using its position -# (you would need to import sys package above) +# (you would need to import sys package above, and uncomment the args in action.yaml) # name = sys.argv[1] if len(sys.argv) > 1 else "World" greeting = f"Hello, {name}! Time is {dt.datetime.now(dt.timezone.utc):%H:%M:%S} UTC." From 633676b91f4e1aca4e0c24f9b626bb5851be143e Mon Sep 17 00:00:00 2001 From: los0220 <62251722+los0220@users.noreply.github.com> Date: Wed, 11 Feb 2026 12:52:17 +0100 Subject: [PATCH 2/2] fix: github injects INPUT_WHO-TO-GREET, hyphens are not replaced by underscores (#135) --- .../python-container-action/action.yaml | 9 ++------- .../python-container-action/entrypoint.py | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/06-authoring-actions/container-actions/python-container-action/action.yaml b/06-authoring-actions/container-actions/python-container-action/action.yaml index e454daad..f4a38ee4 100644 --- a/06-authoring-actions/container-actions/python-container-action/action.yaml +++ b/06-authoring-actions/container-actions/python-container-action/action.yaml @@ -14,10 +14,5 @@ runs: image: Dockerfile # Option B – use a pre-built image to avoid rebuilds: # image: docker://ghcr.io/your-org/hello-python-action:v1 - - # Passing the input as an environmental variable - env: - INPUT_WHO_TO_GREET: ${{ inputs.who-to-greet }} - # Passing the value in the args list - # args: - # - ${{ inputs.who-to-greet }} + args: + - ${{ inputs.who-to-greet }} diff --git a/06-authoring-actions/container-actions/python-container-action/entrypoint.py b/06-authoring-actions/container-actions/python-container-action/entrypoint.py index 55c2561f..2b2a24df 100644 --- a/06-authoring-actions/container-actions/python-container-action/entrypoint.py +++ b/06-authoring-actions/container-actions/python-container-action/entrypoint.py @@ -2,11 +2,11 @@ import os, datetime as dt -# Read the input from the passed environmental variable -name = os.getenv("INPUT_WHO_TO_GREET", "World") +# GitHub injects INPUT_WHO-TO-GREET based on the input name (only spaces get replaced with underscores, not hyphens) +name = os.getenv("INPUT_WHO-TO-GREET", "World") # Alternatively, you could read it from the args list using its position -# (you would need to import sys package above, and uncomment the args in action.yaml) +# (you would need to import sys package above) # name = sys.argv[1] if len(sys.argv) > 1 else "World" greeting = f"Hello, {name}! Time is {dt.datetime.now(dt.timezone.utc):%H:%M:%S} UTC."