diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index 9ce0483..6527ccd 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -46,11 +46,20 @@ jobs: if [ $EXISTING_PR -eq 0 ] then TITLE="syslog-ng-cfg-helper: $VERSION" - BODY="Generate from https://pypi.org/project/syslog-ng-cfg-helper/$VERSION" + BODY=$(mktemp) + echo "Generated from https://pypi.org/project/syslog-ng-cfg-helper/$VERSION" > $BODY + echo >> $BODY + echo 'For your convenience, here is a human-readable diff of the change:' >> $BODY + echo '```diff' >> $BODY + set +e + diff -u --label a/syntax/syslog-ng.vim <(git diff syntax/syslog-ng.vim | grep '^-syn keyword' | tr ' ' '\n' | tail -n +3) \ + --label b/syntax/syslog-ng.vim <(git diff syntax/syslog-ng.vim | grep '^+syn keyword' | tr ' ' '\n' | tail -n +3) >> $BODY + set -e + echo '```' >> $BODY git switch -c "$BRANCH" git commit -a -s -m "$TITLE" git push --force origin "$BRANCH" - gh pr create --title "$TITLE" --body "$BODY" + gh pr create --title "$TITLE" --body-file "$BODY" else echo "Pull Request already exists" fi diff --git a/generate b/generate index ddad3f4..4be73aa 100755 --- a/generate +++ b/generate @@ -16,7 +16,7 @@ db = JSON.parse(File.read(ARGV[0])) def find_keywords(hash) keywords = [] hash.each do |key, value| - if key == 'name' && value && !value.start_with?('<') + if key == 'name' && value && value.is_a?(String) && !value.start_with?('<') keywords << value keywords << value.gsub('-', '_') elsif value.is_a?(Hash)