Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
chore: Prevent injection from PR title
  • Loading branch information
franky47 committed Aug 31, 2025
commit 5db40e9988c443adea1eb3d7c1350ea3ccaaaa50
21 changes: 19 additions & 2 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ jobs:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile --workspace-root
run: pnpm add -D @commitlint/load @commitlint/lint
- name: Lint PR title
run: echo "${{ github.event.pull_request.title }}" | ./node_modules/.bin/commitlint > $GITHUB_STEP_SUMMARY
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
node -e "
import loadConfig from '@commitlint/load'
import lint from '@commitlint/lint'
import pkgJson from './package.json' assert { type: 'json' }
const config = await loadConfig(pkgJson.commitlint)
const result = await lint(process.env.TITLE, config.rules, config.parserPreset ? { parserOpts: config.parserPreset.parserOpts } : {})
process.env.GITHUB_STEP_SUMMARY += `## Linting Result\n- Valid: ${result.valid}\n`
if (!result.valid) {
for (const { message } of result.errors) {
process.env.GITHUB_STEP_SUMMARY += `- Error: ${message}\n`
console.error(message)
}
process.exit(1)
}
"