Skip to content

Commit 3e03271

Browse files
committed
Update semantic-check.yml
1 parent 9b339c4 commit 3e03271

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

.github/workflows/semantic-check.yml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Semantic Version Check
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened, synchronize, reopened]
66

77
jobs:
@@ -17,6 +17,7 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919
with:
20+
ref: ${{ github.event.pull_request.head.sha }}
2021
fetch-depth: 0
2122
persist-credentials: false
2223

@@ -46,28 +47,18 @@ jobs:
4647
@semantic-release/release-notes-generator
4748
env:
4849
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
50-
- name: Create comment content
51-
id: create-comment
52-
run: |
53-
if [ "${{ steps.semantic.outputs.new_release_version }}" != "" ]; then
54-
echo "comment_body=## Semantic Version Check\n\n✅ Valid semantic version changes detected!\n\nNext version will be: **${{ steps.semantic.outputs.new_release_version }}**" >> $GITHUB_OUTPUT
55-
else
56-
echo "comment_body=## Semantic Version Check\n\n⚠️ No semantic version changes detected.\n\nPlease ensure your commits follow the [Conventional Commits](https://www.conventionalcommits.org/) format:\n\n- \`feat: new feature\` (triggers MINOR version bump)\n- \`fix: bug fix\` (triggers PATCH version bump)\n- \`BREAKING CHANGE: description\` (triggers MAJOR version bump)" >> $GITHUB_OUTPUT
57-
fi
5850

59-
- name: Find Comment
60-
uses: peter-evans/find-comment@v3
61-
id: fc
51+
- name: Comment PR
52+
uses: thollander/actions-comment-pull-request@v2
6253
with:
63-
issue-number: ${{ github.event.pull_request.number }}
64-
comment-author: 'github-actions[bot]'
65-
body-includes: 'Semantic Version Check'
54+
message: |
55+
## Semantic Version Check
56+
57+
${{ steps.semantic.outputs.new_release_version && '✅ Valid semantic version changes detected!' || '⚠️ No semantic version changes detected.' }}
58+
59+
${{ steps.semantic.outputs.new_release_version && format('Next version will be: **{0}**', steps.semantic.outputs.new_release_version) || 'Please ensure your commits follow the [Conventional Commits](https://www.conventionalcommits.org/) format:
6660
67-
- name: Create or update comment
68-
uses: peter-evans/create-or-update-comment@v4
69-
with:
70-
comment-id: ${{ steps.fc.outputs.comment-id }}
71-
issue-number: ${{ github.event.pull_request.number }}
72-
body: ${{ steps.create-comment.outputs.comment_body }}
73-
edit-mode: replace
61+
- `feat: new feature` (triggers MINOR version bump)
62+
- `fix: bug fix` (triggers PATCH version bump)
63+
- `BREAKING CHANGE: description` (triggers MAJOR version bump)' }}
64+
comment_tag: semantic-version-check

0 commit comments

Comments
 (0)