Skip to content

Commit

Permalink
Fix #1027: Avoid update-changelog to generate an extra line when ther…
Browse files Browse the repository at this point in the history
…e are no changes (#1029)

* Updating dependencies

* Fix #1027: Avoid update-changelog to generate an extra line when there are no changes
  • Loading branch information
araujoarthur0 authored Nov 1, 2023
1 parent df37f2c commit 542a243
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ChangelogUpdater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
steps:
- name: Check trigger
id: check
uses: khan/pull-request-comment-trigger@master
uses: khan/pull-request-comment-trigger@v1.1.0
with:
trigger: '\changelog-update'
reaction: rocket
prefix_only: 'true'
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
- uses: tibdex/github-app-token@v1
- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
Expand All @@ -39,7 +39,7 @@ jobs:
echo "COMMENT_AUTHOR_ASSOCIATION: $COMMENT_AUTHOR_ASSOCIATION"
- name: Clone git repo
if: steps.check.outputs.triggered == 'true'
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Configure Git Agent
if: steps.check.outputs.triggered == 'true'
run: |
Expand Down
6 changes: 4 additions & 2 deletions scripts/update-changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ def get_updated_file_content(current_changelog_lines: str, new_change: any, new_
if line == g_end_changes:
is_sourcing_changes = False
new_file_content.extend(get_sorted_unique_entries(changes))
# adds an extra item to avoid issues with the linter
new_file_content.append('')
# adds an extra item to avoid issues with the linter, but only if there is at least one entry
if new_file_content[-1] != '':
new_file_content.append('')

if line == g_end_users:
is_sourcing_users = False
Expand All @@ -68,6 +69,7 @@ def get_updated_file_content(current_changelog_lines: str, new_change: any, new_

# Include on extra empty line to comply with markdown formatter
new_file_content.append('')

return new_file_content

def update_changelog(changelog_filename: str, new_change: any, new_user: any):
Expand Down

0 comments on commit 542a243

Please sign in to comment.