Skip to content
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
36520e2
Change pull_request to pull_request_target
ayeshurun Sep 17, 2025
444d351
Merge pull request #4 from ayeshurun/fix-semantic-pr
ayeshurun Sep 17, 2025
8b34e28
Merge branch 'microsoft:main' into main
ayeshurun Sep 18, 2025
0c47fda
Merge branch 'microsoft:main' into main
ayeshurun Sep 18, 2025
ccd7b91
Merge branch 'microsoft:main' into main
ayeshurun Sep 21, 2025
43cc353
Merge branch 'microsoft:main' into main
ayeshurun Sep 21, 2025
ea76426
Merge branch 'microsoft:main' into main
ayeshurun Sep 28, 2025
c702b91
Merge branch 'microsoft:main' into main
ayeshurun Sep 29, 2025
5e847ef
Merge branch 'microsoft:main' into main
ayeshurun Oct 16, 2025
69c733e
Merge branch 'microsoft:main' into main
ayeshurun Oct 20, 2025
5d5f1ad
Merge branch 'microsoft:main' into main
ayeshurun Oct 20, 2025
0c5de9c
Merge branch 'microsoft:main' into main
ayeshurun Oct 21, 2025
025f456
Merge branch 'microsoft:main' into main
ayeshurun Oct 22, 2025
df0c5a4
Merge branch 'microsoft:main' into main
ayeshurun Oct 23, 2025
c6892ed
Merge branch 'microsoft:main' into main
ayeshurun Oct 26, 2025
f30ce9b
Merge branch 'microsoft:main' into main
ayeshurun Nov 4, 2025
cf7e06b
Merge branch 'microsoft:main' into main
ayeshurun Nov 11, 2025
875dcf3
Remove comments creation in changie workflow
Nov 11, 2025
c58eaf9
Rename workflow
Nov 11, 2025
f43a7ef
Add clearer message
Nov 11, 2025
0352f8a
Enhance error message
Nov 11, 2025
1e85dc5
Fix
Nov 11, 2025
3a25ea2
Fix
Nov 11, 2025
14b25f4
Fix
Nov 11, 2025
1faf956
Fix
Nov 11, 2025
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
127 changes: 5 additions & 122 deletions .github/workflows/changelog-existence.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
---
name: πŸ”„ Changelog Existence
name: πŸ”„ Changelog

on:
pull_request:
Expand All @@ -19,9 +19,7 @@ concurrency:
cancel-in-progress: true

permissions:
pull-requests: write
contents: read
issues: write

jobs:
changelog-existence:
Expand Down Expand Up @@ -61,99 +59,19 @@ jobs:
if: steps.changelog_check.outputs.exists == 'true'
run: npm i -g changie

- name: πŸ”Ž Find comment
id: fc
uses: actions/github-script@v6
with:
script: |
const commentMarker = '<!-- changelog -->';
console.log('Searching for existing changelog comment...');
console.log(`PR Number: ${context.issue.number}`);
console.log(`Repo: ${context.repo.repo}`);
console.log(`Owner: ${context.repo.owner}`);
const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});

const comment = comments?.find(c => c.user.login === 'github-actions[bot]' && c.body.includes(commentMarker));
if (comment) {
console.log(`Found existing changelog comment: ${comment.id}`);
return comment.id;
}
console.log('No existing changelog comment found.');
return null;

- name: πŸ”„ Prepare comment (changelog)
if: steps.changelog_check.outputs.exists == 'true'
run: |
echo -e "# Changelog Preview\n" > changie.md
changie batch patch --dry-run --prerelease 'dev' >> changie.md
cat changie.md >> $GITHUB_STEP_SUMMARY
echo -e "\n<!-- changelog -->" >> changie.md

- name: πŸ“ Create or Update comment (changelog)
if: steps.changelog_check.outputs.exists == 'true'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('changie.md', 'utf8');
console.log('Preparing to create or update changelog comment...');
console.log(`body is: \n\n '${body}'`);
const comment_id = ${{ steps.fc.outputs.result }};
console.log(`Comment ID: ${comment_id}`);
if (comment_id) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment_id,
body: body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body,
});
}

- name: πŸ”„ Prepare comment (missing)
if: steps.changelog_check.outputs.exists == 'false'
run: |
echo -e "# πŸ›‘ Changelog entry required to merge\n" > changie.md
echo "Run \`changie new\` to add a new changelog entry" >> changie.md
cat changie.md >> $GITHUB_STEP_SUMMARY
echo -e "\n<!-- changelog -->" >> changie.md

- name: πŸ“ Create or Update comment (missing)
if: steps.changelog_check.outputs.exists == 'false'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('changie.md', 'utf8');
console.log('Preparing to create or update missing changelog comment...');
console.log(`body is: \n\n '${body}'`);
const comment_id = ${{ steps.fc.outputs.result }};
console.log(`Comment ID: ${comment_id}`);
if (comment_id) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment_id,
body: body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: body,
});
}

- name: βœ… Pass if changelog entry exists
if: steps.changelog_check.outputs.exists == 'true'
Expand All @@ -165,50 +83,15 @@ jobs:
if: steps.changelog_check.outputs.exists == 'false'
run: |
echo "πŸ›‘ Changelog entry required to merge."
echo "πŸ›‘ Please run 'changie new' to add a new changelog entry."
exit 1

changelog-skip:
name: ⏭️ Skip Changelog
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changelog') || github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: πŸ”Ž Find comment
if: github.actor != 'dependabot[bot]'
id: fc
uses: actions/github-script@v6
with:
script: |
const commentMarker = '<!-- changelog -->';
const { data: comments } = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
if (!comments) {
return null;
}
const comment = comments.find(c => c.user.login === 'github-actions[bot]' && c.body.includes(commentMarker));
if (comment) {
console.log(`Found existing changelog comment: ${comment.id}`);
return comment.id;
}
console.log('No existing changelog comment found.');
return null;

- name: πŸ—‘οΈ Delete comment
uses: actions/github-script@v6
if: github.actor != 'dependabot[bot]' && steps.fc.outputs.result != ''
with:
script: |
const commentId = ${{ steps.fc.outputs.result }};
console.log(`Deleting existing changelog comment due to skip label... ID: ${commentId}`);
if (commentId) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId,
});
}

- name: βœ… Pass (skip)
run: exit 0
run: |
echo "⏭️ Changelog check skipped." >> $GITHUB_STEP_SUMMARY
exit 0
Loading