Skip to content

fix: safer dogbench subprocess — list args, cwd=, FileNotFoundError, … #95

fix: safer dogbench subprocess — list args, cwd=, FileNotFoundError, …

fix: safer dogbench subprocess — list args, cwd=, FileNotFoundError, … #95

Workflow file for this run

name: semver-guard
on:
pull_request:
types: [opened, edited, synchronize, reopened]
push:
branches: [main]
jobs:
validate-title:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: validate PR title is conventional commit
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request.title;
const prNumber = context.payload.pull_request.number;
const allowed = ['feat', 'fix', 'chore', 'docs', 'refactor', 'perf', 'ci', 'test', 'style'];
const re = new RegExp(`^(${allowed.join('|')})(\\(.+\\))?:\\s.+`);
if (!re.test(title)) {
const msg = `❌ **Semver violation** — PR title must be a conventional commit.
**Expected format:** \`type: description\`
**Allowed types:** \`${allowed.join('`, `')}\`
Examples:
- \`feat: add MCP on-demand toggle\`
- \`fix: wire benchmark dispatch\`
- \`chore: bump deps\`
Rename the PR to fix this.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: msg
});
core.setFailed(`PR title "${title}" is not a conventional commit`);
} else {
console.log(`✅ Valid conventional commit: "${title}"`);
}
- name: check version bump for feat/fix
if: success() || failure()
uses: actions/github-script@v7
with:
script: |
const title = context.payload.pull_request.title;
const prNumber = context.payload.pull_request.number;
if (!/^(feat|fix)(\(.+\))?:/.test(title)) {
console.log('Not a feat/fix PR — skipping version bump check');
return;
}
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber
});
const versionBumped = files.some(f => f.filename === 'pyproject.toml');
if (!versionBumped) {
const msg = `❌ **Version bump required** — \`feat:\` and \`fix:\` PRs MUST bump the version in \`pyproject.toml\`.
- \`feat:\` → bump MINOR (e.g. 1.0.2 → 1.1.0)
- \`fix:\` → bump PATCH (e.g. 1.0.2 → 1.0.3)
This is enforced. Add the version bump to proceed.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: msg
});
core.setFailed(`Version bump missing in pyproject.toml`);
} else {
console.log('✅ pyproject.toml modified — version bump detected');
}
# Dummy job on push to main so badge shows green
badge:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- run: echo "semver-guard active on main"