Skip to content

Commit 6a5d805

Browse files
authored
fix(ci): CHANGELOG.md generation fix for 'no change' and yoshi-code-bot email (#9566)
1 parent 0158232 commit 6a5d805

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

.github/release-note-generation/split_release_note.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ def create_changelog_entry(current_date: str, module: LibraryModule,
9494
changelog_entry += '### Features\n\n'
9595
for line in changelog_lines:
9696
changelog_entry += f'* {line}\n'
97+
changelog_entry += '\n'
9798
if dependency_changes:
98-
changelog_entry += "\n### Dependencies\n\n"
99+
changelog_entry += "### Dependencies\n\n"
99100
for line in dependency_changes:
100101
changelog_entry += f'* {line}\n'
102+
103+
if len(changelog_lines) == 0 and len(dependency_changes) == 0:
104+
changelog_entry += '* No change\n'
101105
return changelog_entry
102106

103107

.github/release-note-generation/unit_test.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
class TestCase(unittest.TestCase):
1515

1616
def test_create_changelog_entry(self):
17-
# do something
1817
entry = create_changelog_entry(
1918
'2023-06-10',
2019
dummy_module,
@@ -34,6 +33,31 @@ def test_create_changelog_entry(self):
3433
* update google-cloud-shared-dependencies to 1.2.3
3534
''')
3635

36+
def test_create_changelog_entry_only_deps(self):
37+
entry = create_changelog_entry(
38+
'2023-06-10',
39+
dummy_module,
40+
[],
41+
['update google-cloud-shared-dependencies to 1.2.3']
42+
)
43+
self.assertEqual(entry, f'''## 1.2.3 (2023-06-10)
44+
45+
### Dependencies
46+
47+
* update google-cloud-shared-dependencies to 1.2.3
48+
''')
49+
50+
def test_create_changelog_entry_empty(self):
51+
entry = create_changelog_entry(
52+
'2023-06-10',
53+
dummy_module,
54+
[],
55+
[]
56+
)
57+
self.assertEqual(entry, f'''## 1.2.3 (2023-06-10)
58+
59+
* No change
60+
''')
3761

3862
def test_group_changes_by_api(self):
3963
main_changes = [

.github/workflows/changelog_generation.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v3
2424
with:
25-
fetch-depth: 0
2625
ref: ${{ github.head_ref }}
2726
- name: Show status of the branch checked out
2827
run: |
@@ -40,7 +39,7 @@ jobs:
4039
python3 .github/release-note-generation/split_release_note.py pr_body.txt .
4140
- name: Commit the change and push to the pull request branch
4241
run: |
43-
git config user.email "yoshi-code-bot[bot]@users.noreply.github.com"
42+
git config user.email "[email protected]"
4443
git config user.name "yoshi-code-bot"
4544
git remote set-url origin https://x-access-token:${{ secrets.YOSHI_CODE_BOT_TOKEN }}@github.com/${{ github.repository }}
4645
git add ./*/CHANGELOG.md

0 commit comments

Comments
 (0)