Draft release notes on milestone close
ADD
.github/workflows/draft-release-notes-on-milestone-close.yaml
+name: Create draft release notes
+on:
+ milestone:
+ types: [closed]
+
+jobs:
+ draft_release_notes:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Get pull requests for milestone
+ id: pullsA
+ uses: actions/github-script@0.9.0
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ const options = github.pulls.list.endpoint.merge({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ state: 'closed'
+ })
+
+ const pullRequests = await github.paginate(options)
+
+ return pullRequests.filter(pullRequest => pullRequest.merged_at
+ && pullRequest.milestone
+ && pullRequest.milestone.number == ${{ github.event.milestone.number }})
+ - name: Generate release notes text
+ id: generate
+ uses: actions/github-script@0.9.0
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ var draftText = "# Improvements \n\n# Changes \n\n"
+ for (let pull of ${{ steps.pullsA.outputs.result }}) {
+ draftText += "* " + pull.title + " #" + pull.number + " \n"
+ }
+ draftText += "\n# Fixes \n"
+ return draftText
+ - name: Create release notes draft
+ uses: actions/github-script@0.9.0
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ await github.repos.createRelease({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ tag_name: 'v' + '${{ github.event.milestone.title }}',
+ name: '${{ github.event.milestone.title}}',
+ draft: true,
+ body: ${{ steps.generate.outputs.result }}
+ })
\ No newline at end of file

Draft release notes on milestone close