@@ -762,11 +762,16 @@ jobs:
762762 timeout-minutes : 30
763763 permissions :
764764 contents : write
765+ # Release notes read PR bodies and authors.
766+ pull-requests : read
765767 steps :
766768 - name : Checkout
767769 uses : actions/checkout@v6
768770 with :
769771 ref : ${{ needs.preflight.outputs.ref }}
772+ # Release notes need history back to the previous tag, not file contents.
773+ fetch-depth : 0
774+ filter : blob:none
770775 sparse-checkout : |
771776 /*
772777 !/.repos/
@@ -892,6 +897,27 @@ jobs:
892897 echo 'EOF'
893898 } >> "$GITHUB_OUTPUT"
894899
900+ # A short model summary over GitHub's full list. Without a notes file, the
901+ # release falls back to GitHub's generated notes.
902+ - name : Write release notes
903+ if : needs.preflight.outputs.release_channel != 'preview' && needs.preflight.outputs.previous_tag != ''
904+ continue-on-error : true
905+ timeout-minutes : 5
906+ env :
907+ GH_TOKEN : ${{ github.token }}
908+ OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
909+ run : |
910+ node scripts/generate-release-notes.ts \
911+ --repository "${{ github.repository }}" \
912+ --tag "${{ needs.preflight.outputs.tag }}" \
913+ --ref "${{ needs.preflight.outputs.ref }}" \
914+ --previous-tag "${{ needs.preflight.outputs.previous_tag }}" \
915+ --version "${{ needs.preflight.outputs.version }}" \
916+ --output release-notes.md
917+ if [[ -f release-notes.md ]]; then
918+ cat release-notes.md >> "$GITHUB_STEP_SUMMARY"
919+ fi
920+
895921 # A preview release gets a warning instead of generated notes. Generated
896922 # notes would list every commit since the previous preview, which is
897923 # unmerged branch history no one should read as a changelog, and would
@@ -917,8 +943,8 @@ jobs:
917943 tag_name : ${{ needs.preflight.outputs.tag }}
918944 target_commitish : ${{ needs.preflight.outputs.ref }}
919945 name : ${{ needs.preflight.outputs.release_name }}
920- generate_release_notes : ${{ needs.preflight.outputs.release_channel != 'preview ' }}
921- body_path : ${{ needs.preflight.outputs.release_channel == 'preview ' && 'release-notes.md' || '' }}
946+ generate_release_notes : ${{ hashFiles('release-notes.md') == ' ' }}
947+ body_path : ${{ hashFiles('release-notes.md') != ' ' && 'release-notes.md' || '' }}
922948 previous_tag : ${{ needs.preflight.outputs.previous_tag }}
923949 prerelease : ${{ needs.preflight.outputs.is_prerelease }}
924950 make_latest : ${{ needs.preflight.outputs.make_latest }}
0 commit comments