Skip to content

Commit

Permalink
github/update: improve summary for generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Jul 15, 2024
1 parent bd1ddda commit cff06c8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF" >> "$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
Expand All @@ -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 }}
Expand Down

0 comments on commit cff06c8

Please sign in to comment.