Skip to content

Update test-2.yml

Update test-2.yml #5

Workflow file for this run

name: Test-2 Workflow Name
on:
push:
branches:
- playground
paths:
- .github/workflows/test-2.yml
workflow_dispatch:
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- shell: bash
run: |
echo "Env:"
env | awk -F '=' '{ printf(" %-25s = ", $1); for (i = 2; i <= NF; i++) printf("%s", $i); print ""; }'
# Iterate through all environment variables
for var in $(compgen -e); do
# Get the value of the environment variable
value="${!var}"
echo "Testing '$value'"
# Check if the value is a readable file
if test -f "$value" && file -b "$value" | grep -q "text"; then
# Print the header with the realpath of the file
echo "File: $(realpath "$value")"
# If the file is a JSON file, use jq to pretty-print it
if [[ "$(file -b --mime-type "$value")" == "application/json" ]]; then
echo " JSON content:"
jq . "$value" | sed 's/^/ /'
else
# Otherwise, print the content indented with two spaces
echo " Content:"
echo " $(cat "$value")"
fi
fi
done