From 470e5d96cd938a5e5ed3fb6f12f75733cb2fe7dc Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 9 Mar 2025 17:21:19 -0600 Subject: [PATCH] Enhance Base64 templates GitHub Action workflow with improved formatting --- .github/workflows/base64-templates.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/base64-templates.yml b/.github/workflows/base64-templates.yml index 98f2e221..c96cee11 100644 --- a/.github/workflows/base64-templates.yml +++ b/.github/workflows/base64-templates.yml @@ -2,13 +2,11 @@ name: Generate Base64 Blueprints Table on: pull_request: - paths: - - 'blueprints/**' + branches: + - main push: branches: - main - paths: - - 'blueprints/**' jobs: encode-and-comment: @@ -23,28 +21,33 @@ jobs: run: | echo "### 📝 Blueprints Base64 Table" > comment.md echo '' >> comment.md - echo '| Template | Base64 |' >> comment.md - echo '|----------|--------|' >> comment.md + echo '| Template | Base64 (short) |' >> comment.md + echo '|----------|----------------|' >> comment.md for dir in blueprints/*; do if [ -d "$dir" ]; then TEMPLATE_NAME=$(basename "$dir") - + COMPOSE_FILE="$dir/docker-compose.yml" TEMPLATE_FILE="$dir/template.yml" - + if [ -f "$COMPOSE_FILE" ] && [ -f "$TEMPLATE_FILE" ]; then CONTENT=$(cat "$COMPOSE_FILE" "$TEMPLATE_FILE" | base64 -w 0) - SHORT_CONTENT="${CONTENT:0:50}..." # Primera parte para la tabla + SHORT_CONTENT="${CONTENT:0:50}..." + + # Add table row with short base64 preview echo "| $TEMPLATE_NAME | \`$SHORT_CONTENT\` |" >> comment.md - # Detalle completo + # Add collapsible full base64 section echo '' >> comment.md - echo "#### $TEMPLATE_NAME Full Base64" >> comment.md + echo "
" >> comment.md + echo "🔍 $TEMPLATE_NAME Full Base64" >> comment.md echo '' >> comment.md echo '```' >> comment.md echo "$CONTENT" >> comment.md echo '```' >> comment.md + echo '
' >> comment.md + echo '' fi fi done