Release v0.0.6 #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Release Notes | |
| on: | |
| workflow_dispatch: # Manual trigger | |
| release: | |
| types: [published, edited] # Automatic trigger when releases are published or edited | |
| permissions: | |
| contents: read | |
| jobs: | |
| sync-release-notes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Need write permission to update CHANGELOG.md | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 # Fetch all history so we can work with all releases | |
| - name: Setup Node.js | |
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | |
| with: | |
| node-version: '20.x' | |
| - name: Sync GitHub release notes to CHANGELOG.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Run the sync script from the scripts directory | |
| node scripts/sync-changelog.js | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet CHANGELOG.md; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected in CHANGELOG.md" | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected in CHANGELOG.md" | |
| fi | |
| - name: Ensure on main branch | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git checkout main | |
| - name: Commit and push changes | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add CHANGELOG.md | |
| git commit -m "docs: sync CHANGELOG.md with GitHub release notes | |
| This commit automatically updates the CHANGELOG.md file to match | |
| the release notes from GitHub releases, ensuring consistency | |
| between local documentation and published releases." | |
| git push | |
| - name: Summary | |
| run: | | |
| if [ "${{ steps.changes.outputs.changed }}" == "true" ]; then | |
| echo "✅ CHANGELOG.md has been successfully updated with GitHub release notes" | |
| else | |
| echo "ℹ️ CHANGELOG.md was already up to date with GitHub release notes" | |
| fi |