Skip to content

Commit 1329126

Browse files
authored
chore(gha): test changelog workflow (#27)
* chore(gha): test changelog workflow * chore(gha): change comment body * chore(gha): change add changes * chore(gha): message on success
1 parent 1a5d828 commit 1329126

File tree

8 files changed

+25
-12
lines changed

8 files changed

+25
-12
lines changed

.github/workflows/pull-request-changelog.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,30 @@ jobs:
2929
id: check_folders
3030
run: |
3131
missing_changelogs=""
32-
32+
3333
for folder in api ui prowler; do
3434
if grep -q "^${folder}/" changed_files.txt; then
3535
echo "Detected changes in ${folder}/"
3636
if ! grep -q "^${folder}/CHANGELOG.md$" changed_files.txt; then
3737
echo "No changelog update found for ${folder}/"
38-
missing_changelogs="${missing_changelogs}${folder} "
38+
missing_changelogs="${missing_changelogs}- \`${folder}\`\n"
3939
fi
4040
fi
4141
done
42-
43-
echo "missing_changelogs=${missing_changelogs}" >> $GITHUB_OUTPUT
42+
43+
echo "missing_changelogs<<EOF" >> $GITHUB_OUTPUT
44+
echo -e "${missing_changelogs}" >> $GITHUB_OUTPUT
45+
echo "EOF" >> $GITHUB_OUTPUT
4446

4547
- name: Comment on PR if changelog is missing
46-
if: steps.check_folders.outputs.missing_changelogs != ''
47-
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
48+
uses: peter-evans/create-or-update-comment@v4
4849
with:
4950
issue-number: ${{ github.event.pull_request.number }}
51+
body-identifier: changelog-check
5052
body: |
51-
⚠️ **Changes detected in the following folders that have not been updated in your CHANGELOG.md**:
52-
${{ steps.check_folders.outputs.missing_changelogs }}
53-
54-
Please add an entry to the corresponding `CHANGELOG.md` to maintain a clear history of changes.
53+
${{ steps.check_folders.outputs.missing_changelogs != '' && format(
54+
'⚠️ **Changes detected in the following folders without a corresponding update to the `CHANGELOG.md`:**
55+
56+
{0}
57+
58+
Please add an entry to the corresponding `CHANGELOG.md` file to maintain a clear history of changes.', steps.check_folders.outputs.missing_changelogs) || '✅ All necessary CHANGELOG.md files have been updated. Great job! 🎉' }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.code
2+
.idea

api/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
API Changelog
1+
API Changelog
2+
3+
- New file `hello-world.txt`

api/hello-world.txt

Whitespace-only changes.

prowler/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Prowler Changelog
1+
Prowler Changelog
2+
3+
- New file `hello-world.txt`

prowler/hello-world.txt

Whitespace-only changes.

ui/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
UI Changelog
2+
3+
- New file `hello-world.txt`

ui/hello-world.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)