diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6387dbf..984619d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -305,6 +305,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + pull-requests: read steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -324,10 +325,14 @@ jobs: done cp artifacts/vsix-*/*.vsix dist/ 2>/dev/null || true - # The notes come from the PRs merged since the previous tag, grouped by `.github/release.yml`; - # edit them on the release page afterwards if needed. + # The notes open with the release PR's body, followed by the PRs merged since the previous tag, + # grouped by `.github/release.yml`; edit them on the release page afterwards if needed. - name: Create GitHub Release - run: gh release create "$TAG" --verify-tag --generate-notes dist/* + run: | + gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" | + jq -r --arg ref "chore/release-${TAG#v}" '.[] | select(.merged_at != null and .head.ref == $ref) | .body // ""' \ + > "$RUNNER_TEMP/release-pr-body.md" + gh release create "$TAG" --verify-tag --notes-file "$RUNNER_TEMP/release-pr-body.md" --generate-notes dist/* env: GH_TOKEN: ${{ github.token }} TAG: ${{ needs.verify.outputs.tag }}