name: Release Notes Sync on: push: tags: - "v*" branches: - main paths: - "CHANGELOG.md" workflow_dispatch: inputs: tag: description: "Release tag to sync (e.g. v0.1.14). Leave empty to use top changelog entry." required: false type: string create_if_missing: description: "Create release if missing (normally only needed for tag events)." required: false default: false type: boolean concurrency: group: release-notes-sync-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} cancel-in-progress: false jobs: sync-release-notes: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Sync release body from changelog env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} EVENT_NAME: ${{ github.event_name }} REF: ${{ github.ref }} INPUT_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && github.ref_name || github.event.inputs.tag }} INPUT_CREATE_IF_MISSING: ${{ github.event.inputs.create_if_missing }} shell: bash run: | set -euo pipefail args=(--repo "$REPO") if [ -n "${INPUT_TAG:-}" ]; then args+=(--tag "$INPUT_TAG") fi create_if_missing="false" if [[ "$EVENT_NAME" = "push" && "$REF" == refs/tags/v* ]]; then create_if_missing="true" elif [ "$EVENT_NAME" = "workflow_dispatch" ] && [ "${INPUT_CREATE_IF_MISSING:-false}" = "true" ]; then create_if_missing="true" fi if [ "$create_if_missing" = "true" ]; then args+=(--create-if-missing) fi node scripts/sync-release-notes-from-changelog.mjs "${args[@]}"