* ci(security): run deterministic eval tests in affected-area CI (Task 04) The build-check job validated build + suite structure but never ran the tests, and its summary referenced a `test:ci` script that did not exist. Make affected-area CI meaningful: - Add `test:ci` to evals/framework running the offline, deterministic Vitest allowlist (7 files / 112 tests) — no model, network, or paid execution. - Add a required "Run deterministic tests" step to build-check; a failure fails the job and the existing PR summary gate (which keys on build-check.result) fails closed. - Correct the summary note to state test:ci runs the deterministic allowlist and that model/network agent suites are excluded on PRs. The broader deterministic suite has 3 pre-existing failing files (framework-confidence, logger, test-runner; confirmed failing before this work) which are intentionally out of the allowlist and tracked separately. Validated locally: build, validate:suites:all, and test:ci all exit 0. * ci(security): least privilege permissions + pin actions to SHAs (Task 05) Harden all 9 GitHub Actions workflows: Least privilege: - Add explicit top-level `permissions: contents: read` to installer-checks, validate-test-suites, and opencode (opencode's job keeps the writes it needs; the top level now defaults to read). - Every workflow now declares an explicit top-level permissions block. - Write scopes retained only where justified (releases, doc/registry commits, follow-up PRs, and sync-docs' issues.create). Immutable action pinning: - Pin every `uses:` to a full 40-char commit SHA with a version comment, including first-party actions/* (checkout, github-script, setup-node, upload-artifact) and third-party (oven-sh/setup-bun). - Replace the two mutable refs that could change under us at any push: ludeeus/action-shellcheck@master and sst/opencode/github@latest. Record all SHAs, versions, and permission justifications in docs/maintenance/repository-recovery/action-pin-inventory.md. Verified: all 9 workflows parse as valid YAML; no floating tag/branch refs remain; every workflow has a top-level permissions block. * docs(security): add SECURITY.md and private-reporting checklist (Task 06) - Add root SECURITY.md: supported versions (0.7.x), private reporting via GitHub's "Report a vulnerability", best-effort response expectations, coordinated disclosure, and no-secret guidance. - Add private-vulnerability-reporting checklist that separates repository file work (this PR) from GitHub settings changes that require their own approval (Task 07: enabling private vulnerability reporting). No external links to validate; the reporting path uses the repo Security tab. SECURITY.md documents the private reporting path ahead of Task 07 enabling it. * ci(security): add dependency governance and ownership controls (Task 08) - .github/dependabot.yml: weekly grouped github-actions updates (keeps the Task 05 SHA pins current). Scoped to actions only — the primary lockfile is bun.lock and Dependabot's npm ecosystem would desync it; npm dependency risk is covered by dependency-review below. - .github/workflows/dependency-review.yml: runs on PRs with contents: read, SHA-pinned actions, fail-on-severity: high to block newly introduced high-severity vulnerabilities (exceptions documented inline). - .github/CODEOWNERS: default owner @darrenhinde with explicit ownership of security-sensitive paths (workflows, dependabot, CODEOWNERS, SECURITY.md, scripts/validation). Verified: dependabot.yml and dependency-review.yml are valid YAML; dependency-review actions are SHA-pinned with contents: read; CODEOWNERS owner is the repository owner. * docs(security): record GitHub security settings evidence (Task 07) Enable private vulnerability reporting and record read-back evidence. Settings changed (each approved immediately before, verified by read-back): - Private vulnerability reporting: enabled=false -> enabled=true. The Security tab now offers "Report a vulnerability", making the path documented in SECURITY.md live. - Dependency Graph / Dependabot alerts: 404 -> 204. This was an undocumented prerequisite of Task 08's dependency-review.yml, which failed with "Dependency graph is not enabled"; the Dependency Review check on PR #336 went fail -> pass after enabling it. No other repository setting was modified; secret scanning and push protection are unchanged, and dependabot_security_updates remains disabled (out of scope, would need its own approval). Both changes are reversible via the corresponding DELETE calls. Marks Part B of the private-vulnerability-reporting checklist complete.
209 lines
7.7 KiB
YAML
209 lines
7.7 KiB
YAML
name: Create Release
|
|
|
|
# This workflow creates git tags and GitHub releases after version bump PRs are merged.
|
|
# It detects when a version bump PR (with 'version-bump' label) is merged and creates
|
|
# the corresponding tag and release automatically.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version to release (e.g., 0.5.0)'
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
check-if-version-bump:
|
|
name: Check if Version Bump PR Merged
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should_release: ${{ steps.check.outputs.should_release }}
|
|
version: ${{ steps.check.outputs.version }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Check if this was a version bump PR merge
|
|
id: check
|
|
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
|
|
// Manual trigger - use provided version
|
|
if (context.eventName === 'workflow_dispatch' && context.payload.inputs.version) {
|
|
core.setOutput('should_release', 'true');
|
|
core.setOutput('version', context.payload.inputs.version);
|
|
console.log(`Manual release triggered for version: ${context.payload.inputs.version}`);
|
|
return;
|
|
}
|
|
|
|
// Get the commit that triggered this workflow
|
|
const commit = context.sha;
|
|
|
|
// Find PRs that were merged with this commit
|
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
commit_sha: commit
|
|
});
|
|
|
|
// Check if any of these PRs had the version-bump label
|
|
const versionBumpPR = prs.find(pr =>
|
|
pr.labels.some(label => label.name === 'version-bump')
|
|
);
|
|
|
|
if (versionBumpPR) {
|
|
console.log(`Version bump PR detected: #${versionBumpPR.number}`);
|
|
|
|
// Read VERSION file to get the new version
|
|
const version = fs.readFileSync('VERSION', 'utf8').trim();
|
|
|
|
core.setOutput('should_release', 'true');
|
|
core.setOutput('version', version);
|
|
console.log(`Will create release for version: ${version}`);
|
|
} else {
|
|
console.log('Not a version bump PR - skipping release creation');
|
|
core.setOutput('should_release', 'false');
|
|
}
|
|
|
|
create-tag-and-release:
|
|
name: Create Git Tag and GitHub Release
|
|
runs-on: ubuntu-latest
|
|
needs: check-if-version-bump
|
|
if: needs.check-if-version-bump.outputs.should_release == 'true'
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Check if tag already exists
|
|
id: check_tag
|
|
run: |
|
|
VERSION="${{ needs.check-if-version-bump.outputs.version }}"
|
|
|
|
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
echo "tag_exists=true" >> $GITHUB_OUTPUT
|
|
echo "⚠️ Tag v$VERSION already exists"
|
|
else
|
|
echo "tag_exists=false" >> $GITHUB_OUTPUT
|
|
echo "✅ Tag v$VERSION does not exist - will create"
|
|
fi
|
|
|
|
- name: Create git tag
|
|
if: steps.check_tag.outputs.tag_exists == 'false'
|
|
run: |
|
|
VERSION="${{ needs.check-if-version-bump.outputs.version }}"
|
|
|
|
echo "Creating tag: v$VERSION"
|
|
git tag "v$VERSION"
|
|
git push origin "v$VERSION"
|
|
|
|
echo "## ✅ Git Tag Created" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Tag:** v$VERSION" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Extract release notes from CHANGELOG
|
|
id: release_notes
|
|
run: |
|
|
VERSION="${{ needs.check-if-version-bump.outputs.version }}"
|
|
|
|
if [ -f CHANGELOG.md ]; then
|
|
RELEASE_NOTES=$(awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md)
|
|
|
|
if [ -z "$RELEASE_NOTES" ]; then
|
|
RELEASE_NOTES="Release v$VERSION
|
|
|
|
See [CHANGELOG.md](CHANGELOG.md) for details."
|
|
fi
|
|
else
|
|
RELEASE_NOTES="Release v$VERSION"
|
|
fi
|
|
|
|
echo "$RELEASE_NOTES" > /tmp/release_notes.md
|
|
|
|
echo "## 📝 Release Notes Preview" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
|
cat /tmp/release_notes.md >> $GITHUB_STEP_SUMMARY
|
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
|
|
|
- name: Check if release already exists
|
|
id: check_release
|
|
run: |
|
|
VERSION="${{ needs.check-if-version-bump.outputs.version }}"
|
|
|
|
if gh release view "v$VERSION" >/dev/null 2>&1; then
|
|
echo "release_exists=true" >> $GITHUB_OUTPUT
|
|
echo "⚠️ Release v$VERSION already exists"
|
|
else
|
|
echo "release_exists=false" >> $GITHUB_OUTPUT
|
|
echo "✅ Release v$VERSION does not exist - will create"
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create GitHub release
|
|
if: steps.check_release.outputs.release_exists == 'false'
|
|
run: |
|
|
VERSION="${{ needs.check-if-version-bump.outputs.version }}"
|
|
|
|
echo "Creating GitHub release: v$VERSION"
|
|
|
|
gh release create "v$VERSION" \
|
|
--title "v$VERSION" \
|
|
--notes-file /tmp/release_notes.md \
|
|
--latest
|
|
|
|
echo "## 🚀 GitHub Release Created" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **Release:** v$VERSION" >> $GITHUB_STEP_SUMMARY
|
|
echo "- **URL:** https://github.com/${{ github.repository }}/releases/tag/v$VERSION" >> $GITHUB_STEP_SUMMARY
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Summary
|
|
if: always()
|
|
run: |
|
|
VERSION="${{ needs.check-if-version-bump.outputs.version }}"
|
|
TAG_EXISTS="${{ steps.check_tag.outputs.tag_exists }}"
|
|
RELEASE_EXISTS="${{ steps.check_release.outputs.release_exists }}"
|
|
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "---" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "### 📊 Release Summary" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Version:** v$VERSION" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
if [ "$TAG_EXISTS" = "true" ]; then
|
|
echo "- ⏭️ Git tag already existed (skipped)" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "- ✅ Git tag created" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
if [ "$RELEASE_EXISTS" = "true" ]; then
|
|
echo "- ⏭️ GitHub release already existed (skipped)" >> $GITHUB_STEP_SUMMARY
|
|
else
|
|
echo "- ✅ GitHub release created" >> $GITHUB_STEP_SUMMARY
|
|
fi
|
|
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "🎉 **Release v$VERSION is now available!**" >> $GITHUB_STEP_SUMMARY
|