Tag as top level construct (#2769) #291
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: read | |
if: contains(github.event.head_commit.message, 'Cut release v') | |
steps: | |
- uses: actions/github-script@v7 | |
name: Read Cut release PR info and create release | |
with: | |
script: | | |
const { owner, repo } = context.repo | |
const pulls = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
owner, | |
repo, | |
commit_sha: context.sha, | |
}) | |
const { title, body } = pulls.data[0] | |
const version = title.split('Cut release ')[1] | |
const result = await github.rest.repos.createRelease({ | |
owner, | |
repo, | |
body, | |
tag_name: version, | |
name: version, | |
draft: true, | |
}) | |
console.log(result) |