Skip to content

Commit 23f34fe

Browse files
committed
fix(workflow): update commit message validation to use pull_request_target event
1 parent 1da8fee commit 23f34fe

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/validate-commit-messages.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ permissions:
66
issues: write
77

88
on:
9-
pull_request:
9+
pull_request_target:
1010
types: [opened, edited, synchronize]
1111

1212
jobs:
1313
commitlint:
1414
runs-on: ubuntu-latest
15+
# Security: Only run on events we trust (not from untrusted forks doing malicious things)
16+
if: github.event_name == 'pull_request_target' && github.event.action != 'closed'
1517
steps:
1618
- name: Checkout code
1719
uses: actions/checkout@v4
1820
with:
21+
# For pull_request_target, we need to explicitly checkout the PR head
22+
ref: ${{ github.event.pull_request.head.sha }}
1923
fetch-depth: 0
2024

2125
- name: Setup Node.js
@@ -90,9 +94,6 @@ jobs:
9094
- \`feat(cli)!:\` or \`BREAKING CHANGE:\` → MAJOR release (2.0.0)
9195
- \`fix(shared):\` → No CLI release (affects shared module only)
9296
93-
### 💡 Pro Tip
94-
Run \`./commit-helper.sh\` to get scope suggestions based on your changed files!
95-
9697
Please update your commits and push again. Thank you! 🙏`;
9798
9899
await github.rest.issues.createComment({
@@ -128,5 +129,4 @@ jobs:
128129
echo "2. Follow the format: \`<type>(<scope>): <description>\`" >> $GITHUB_STEP_SUMMARY
129130
echo "3. Run \`./commit-helper.sh\` for scope suggestions" >> $GITHUB_STEP_SUMMARY
130131
echo "" >> $GITHUB_STEP_SUMMARY
131-
echo "📖 See [CONVENTIONAL_COMMITS_GUIDE.md](./CONVENTIONAL_COMMITS_GUIDE.md) for details" >> $GITHUB_STEP_SUMMARY
132132
exit 1

0 commit comments

Comments
 (0)