diff --git a/.github/workflows/polish-release-notes.yml b/.github/workflows/polish-release-notes.yml index 49e2bff8..a58e42bc 100644 --- a/.github/workflows/polish-release-notes.yml +++ b/.github/workflows/polish-release-notes.yml @@ -3,6 +3,8 @@ name: Polish Release Notes # Uses Claude to transform raw changelog into polished release notes. # Triggered automatically by release-prepare after publishing, or manually. on: + repository_dispatch: + types: [polish-release-notes] workflow_dispatch: inputs: tag_name: @@ -11,7 +13,8 @@ on: type: string env: - TAG_NAME: ${{ inputs.tag_name }} + # repository_dispatch passes tag via client_payload, workflow_dispatch via inputs + TAG_NAME: ${{ github.event.client_payload.tag_name || inputs.tag_name }} permissions: contents: write diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/release-prepare.yml index 5e81c9f5..b59653e9 100644 --- a/.github/workflows/release-prepare.yml +++ b/.github/workflows/release-prepare.yml @@ -60,6 +60,9 @@ jobs: # npm authentication handled via OIDC trusted publishing (no token needed) # Trigger release notes polishing after a release is published + # Uses repository_dispatch instead of workflow_dispatch because: + # - workflow_dispatch requires actions:write permission (GitHub App doesn't have it) + # - repository_dispatch works with contents:write (which we already have) - name: Polish release notes if: steps.changesets.outputs.published == 'true' env: @@ -68,4 +71,6 @@ jobs: # Get version from package.json (just bumped by changesets) TAG="v$(jq -r .version package.json)" echo "Triggering polish workflow for $TAG" - gh workflow run polish-release-notes.yml -f tag_name="$TAG" + gh api repos/${{ github.repository }}/dispatches \ + --method POST \ + --input - <<< "{\"event_type\":\"polish-release-notes\",\"client_payload\":{\"tag_name\":\"$TAG\"}}" diff --git a/.github/workflows/test-polish-dispatch.yml b/.github/workflows/test-polish-dispatch.yml deleted file mode 100644 index d621b400..00000000 --- a/.github/workflows/test-polish-dispatch.yml +++ /dev/null @@ -1,133 +0,0 @@ -name: Test Polish Dispatch - -# Temporary workflow to test repository_dispatch before modifying release pipeline. -# Delete this file after validation. - -on: - repository_dispatch: - types: [test-polish-notes] - workflow_dispatch: - inputs: - tag_name: - description: 'Release tag to test (e.g., v0.23.0)' - required: true - type: string - -env: - # repository_dispatch passes tag via client_payload, workflow_dispatch via inputs - TAG_NAME: ${{ github.event.client_payload.tag_name || inputs.tag_name }} - -permissions: - contents: write - -jobs: - test-polish: - if: github.repository == 'Fission-AI/OpenSpec' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Debug context - run: | - echo "Event name: ${{ github.event_name }}" - echo "Tag name: ${{ env.TAG_NAME }}" - - - name: Get current release body - id: get-release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release view "${{ env.TAG_NAME }}" --json body -q '.body' > current-notes.md - echo "Fetched release notes for ${{ env.TAG_NAME }}" - echo "--- Content preview ---" - head -20 current-notes.md - - - name: Transform release notes with Claude - uses: anthropics/claude-code-action@v1 - id: claude - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - github_token: ${{ secrets.GITHUB_TOKEN }} - claude_args: "--allowedTools Write,Read" - prompt: | - Transform the changelog in `current-notes.md` into release notes for OpenSpec ${{ env.TAG_NAME }}. - - ## Voice - - OpenSpec is a developer tool. Write like you're talking to a peer: - - Direct and practical, not marketing copy - - Focus on what changed and why it matters - - Skip the hype, keep it real - - ## Output - - Create two files: - - ### 1. `release-title.txt` - - A short title in this format: - ``` - ${{ env.TAG_NAME }} - [1-4 words describing the release] - ``` - - Examples: - - `v0.18.0 - OPSX Experimental Workflow` - - `v0.16.0 - Antigravity, iFlow Support` - - `v0.15.0 - Gemini CLI, RooCode` - - Rules for title: - - Lead with the most notable addition - - 1-4 words after the dash, no fluff - - If multiple features, comma-separate the top 2 - - For bugfix-only releases, use something like `v0.17.2 - Pre-commit Hook Fix` - - ### 2. `polished-notes.md` - - ```markdown - ## What's New in ${{ env.TAG_NAME }} - - [One sentence: what's the theme of this release?] - - ### New - - - **Feature name** - What it does and why you'd use it - - ### Improved - - - **Area** - What got better - - ### Fixed - - - What was broken, now works - ``` - - Omit empty sections. - - ## Rules - - 1. Write for developers using OpenSpec with AI coding assistants - 2. Remove commit hashes (like `eb152eb:`), PR numbers, and changesets wrappers (`### Minor Changes`) - 3. Lead with what users can do, not implementation details - 4. One to two sentences per item, max - 5. Use **bold** for feature/area names - 6. Skip internal changes (CI, refactors, tests) unless they affect users - 7. If the input is already well-formatted, just clean up structure and remove noise - - Write both files. No other output. - - - name: Show results (dry run - no actual update) - run: | - echo "=== DRY RUN - Would update release ${{ env.TAG_NAME }} ===" - echo "" - if [ -f "release-title.txt" ]; then - echo "--- Title ---" - cat release-title.txt - echo "" - fi - if [ -f "polished-notes.md" ]; then - echo "--- Notes ---" - cat polished-notes.md - fi - echo "" - echo "=== Test complete. If this looks good, the real workflow will work. ==="