name: Release notes on: pull_request: push: branches: - release workflow_run: # zizmor: ignore[dangerous-triggers] workflows: ['Cut release branch'] types: - completed branches: [master] permissions: {} concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: check-release-notes: if: >- github.event_name == 'pull_request' && github.head_ref != 'release' && startsWith(github.head_ref, 'release-notes/') == false && github.event.pull_request.user.login != 'dependabot[bot]' runs-on: depot-ubuntu-latest permissions: contents: read steps: - name: Check if triggered by bot id: bot-check uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | const { data: commit } = await github.rest.git.getCommit({ owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.payload.pull_request.head.sha, }); const skip = commit.author.name === 'github-actions[bot]' && commit.message.startsWith('Generate release notes'); console.log(`Head commit by "${commit.author.name}": ${commit.message.split('\n')[0]}`); console.log(`Skip: ${skip}`); core.setOutput('skip', String(skip)); - name: Checkout if: steps.bot-check.outputs.skip != 'true' uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 persist-credentials: false - name: Get changed files if: steps.bot-check.outputs.skip != 'true' id: changed-files run: | git fetch origin ${GITHUB_BASE_REF} CHANGED_FILES=$(git diff --name-only origin/${GITHUB_BASE_REF}...HEAD) NON_DOCS_FILES=$(echo "$CHANGED_FILES" | grep -v -e "^packages/docs/" -e "^\.github/actions/docs-spelling/" || true) if [ -z "$NON_DOCS_FILES" ] && [ -n "$CHANGED_FILES" ]; then echo "only_docs=true" >> $GITHUB_OUTPUT echo "only documentation files changed, skipping release notes check" else echo "only_docs=false" >> $GITHUB_OUTPUT fi - name: Check release notes if: >- steps.bot-check.outputs.skip != 'true' && steps.changed-files.outputs.only_docs != 'true' uses: ./.github/actions/release-notes/check generate-release-notes: if: >- github.event_name == 'push' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') runs-on: depot-ubuntu-latest environment: release permissions: contents: write pull-requests: read steps: - name: Resolve version id: version env: GH_TOKEN: ${{ github.token }} run: | version=$(gh api "repos/${GITHUB_REPOSITORY}/contents/packages/desktop-client/package.json?ref=release" --jq '.content' | base64 -d | jq -r .version) echo "version=$version" >> "$GITHUB_OUTPUT" echo "notes_branch=release-notes/$version" >> "$GITHUB_OUTPUT" - name: Checkout release-notes branch uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ steps.version.outputs.notes_branch }} fetch-depth: 0 persist-credentials: true - name: Generate release notes uses: ./.github/actions/release-notes/generate with: release-branch: release notes-branch: ${{ steps.version.outputs.notes_branch }} version: ${{ steps.version.outputs.version }}