From cff06c8570d9f14c4c98abe4d90ca15d95ab3951 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Mon, 15 Jul 2024 10:08:59 +0100 Subject: [PATCH] github/update: improve summary for generated files --- .github/workflows/update.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 29e3a907..e7287319 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -71,10 +71,17 @@ jobs: nix run .#generate-files -- --commit new=$(git show --no-patch --format=%h) if [ "$old" != "$new" ]; then - summary=$(git show --no-patch --format=%s) - echo "summary=$summary" >> "$GITHUB_OUTPUT" + body=$(git show --no-patch --format=%b) echo "body<> "$GITHUB_OUTPUT" - git show --no-patch --format=%b >> "$GITHUB_OUTPUT" + if [ -n "$body" ]; then + # Multi-file changes are listed in the body + echo "$body" >> "$GITHUB_OUTPUT" + else + # Single-file changes are only in the summary, + # e.g. "generated: Updated none-ls.nix" + git show --no-patch --format=%s | \ + sed -e 's/^generated:/-/' >> "$GITHUB_OUTPUT" + fi echo "EOF" >> "$GITHUB_OUTPUT" fi @@ -96,7 +103,7 @@ jobs: ``` ## Generate - ${{ steps.generate.outputs.body || steps.generate.outputs.summary || 'No changes' }} + ${{ steps.generate.outputs.body || 'No changes' }} - name: Print summary if: ${{ steps.pr.outputs.pull-request-number }}