Skip to content

fixing create release tag script #2

fixing create release tag script

fixing create release tag script #2

---
name: Create Release Tag
permissions:
contents: read
pull-requests: read
on:
pull_request:
types: ['closed']
branches:
- 'main'
paths:
- 'CHANGELOG.md'
concurrency:
group: 'create-release-${{ github.head_ref }}'
cancel-in-progress: true
jobs:
build:
name: Create Release Tag
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release-prep/')
runs-on: ubuntu-latest
steps:
- name: Get branch name
run: |
branch_name="${{ github.event.pull_request.head.ref }}"
echo "TAG_NAME=${branch_name#release-prep/}" >> $GITHUB_ENV
- name: Create tag
uses: actions/github-script@v5
with:
script: |
echo "Creating tag v${{ env.TAG_NAME }}"
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ env.TAG_NAME }}',
sha: context.sha
})