Skip to content

Commit ae1a649

Browse files
committed
Add a more readable diff in the PR description
The diff mainly consist in a single long line of keywords where new keywords are added and old keywords may be removed. Reviewing this is a pain. Generate a readable diff in the PR body for easily spotting issues.
1 parent 5561735 commit ae1a649

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/upgrade.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,20 @@ jobs:
4646
if [ $EXISTING_PR -eq 0 ]
4747
then
4848
TITLE="syslog-ng-cfg-helper: $VERSION"
49-
BODY="Generate from https://pypi.org/project/syslog-ng-cfg-helper/$VERSION"
49+
BODY=$(mktemp)
50+
echo "Generated from https://pypi.org/project/syslog-ng-cfg-helper/$VERSION" > $BODY
51+
echo >> $BODY
52+
echo 'For your convenience, here is a human-readable diff of the change:' >> $BODY
53+
echo '```diff' >> $BODY
54+
set +e
55+
diff -u --label a/syntax/syslog-ng.vim <(git diff syntax/syslog-ng.vim | grep '^-syn keyword' | tr ' ' '\n' | tail -n +3) \
56+
--label b/syntax/syslog-ng.vim <(git diff syntax/syslog-ng.vim | grep '^+syn keyword' | tr ' ' '\n' | tail -n +3) >> $BODY
57+
set -e
58+
echo '```' >> $BODY
5059
git switch -c "$BRANCH"
5160
git commit -a -s -m "$TITLE"
5261
git push --force origin "$BRANCH"
53-
gh pr create --title "$TITLE" --body "$BODY"
62+
gh pr create --title "$TITLE" --body-file "$BODY"
5463
else
5564
echo "Pull Request already exists"
5665
fi

0 commit comments

Comments
 (0)