Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1027: Avoid update-changelog to generate an extra line when there are no changes #1029

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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