Skip to content

Commit

Permalink
Update action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
shayki5 authored Jul 25, 2024
1 parent 2ee6239 commit 8812fab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
description: 'Whether to print environment variables'
required: false
default: 'false'
add_to_summary:
description: 'Whether to add inputs to GitHub Summary'
required: false
default: 'false'
outputs:
output:
description: 'The output of the action'
Expand All @@ -20,6 +24,7 @@ runs:
shell: bash
env:
PRINT_ENV_VARS: ${{ inputs.print_env_vars }}
ADD_TO_SUMMARY: ${{ inputs.add_to_summary }}
run: |
output=$(
echo "Checking for workflow_dispatch inputs:"
Expand All @@ -28,6 +33,11 @@ runs:
inputs=$(jq -r '.inputs // empty' "$GITHUB_EVENT_PATH")
if [ -n "$inputs" ] && [ "$inputs" != "null" ]; then
echo "$inputs" | jq -r 'to_entries[] | "\(.key): \(.value)"'
if [ "$ADD_TO_SUMMARY" = "true" ]; then
echo -e "\n<details>\n<summary>Workflow Dispatch Inputs</summary>\n\n\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "$inputs" | jq -r 'to_entries[] | "\(.key): \(.value)"' >> $GITHUB_STEP_SUMMARY
echo -e "\n\`\`\`\n</details>" >> $GITHUB_STEP_SUMMARY
fi
else
echo "No workflow_dispatch inputs found in the event payload."
fi
Expand Down

0 comments on commit 8812fab

Please sign in to comment.