Skip to content

Commit 4650201

Browse files
authored
Update action.yml
1 parent 2c309ba commit 4650201

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

action.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@ runs:
2020
PRINT_ENV_VARS: ${{ inputs.print_env_vars }}
2121
run: |
2222
{
23-
echo "Printing all workflow_dispatch inputs:"
24-
if [ -n "$GITHUB_EVENT_PATH" ] && [ -f "$GITHUB_EVENT_PATH" ]; then
25-
inputs=$(jq -r '.inputs // empty' "$GITHUB_EVENT_PATH")
26-
if [ -n "$inputs" ] && [ "$inputs" != "null" ]; then
27-
echo "$inputs" | jq -r 'to_entries[] | "\(.key): \(.value)"'
23+
echo "Checking for workflow_dispatch inputs:"
24+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
25+
if [ -n "$GITHUB_EVENT_PATH" ] && [ -f "$GITHUB_EVENT_PATH" ]; then
26+
inputs=$(jq -r '.inputs // empty' "$GITHUB_EVENT_PATH")
27+
if [ -n "$inputs" ] && [ "$inputs" != "null" ]; then
28+
echo "$inputs" | jq -r 'to_entries[] | "\(.key): \(.value)"'
29+
else
30+
echo "No workflow_dispatch inputs found in the event payload."
31+
fi
2832
else
29-
echo "No workflow_dispatch inputs found in the event payload."
33+
echo "GITHUB_EVENT_PATH is not set or the file does not exist."
3034
fi
3135
else
32-
echo "GITHUB_EVENT_PATH is not set or the file does not exist. This action may not be running in a workflow_dispatch context."
36+
echo "This is not a workflow_dispatch event. No inputs expected."
3337
fi
3438
3539
if [ "$PRINT_ENV_VARS" = "true" ]; then

0 commit comments

Comments
 (0)