diff --git a/.github/workflows/tag_release.yml b/.github/workflows/tag_release.yml index 15598c86..f0d0c6d3 100644 --- a/.github/workflows/tag_release.yml +++ b/.github/workflows/tag_release.yml @@ -3,7 +3,11 @@ name: Create Github Release on: push: tags: - - '[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+' + +# Permission can be added at job level or workflow level +permissions: + contents: write # This is required for actions/checkout and create release jobs: release: @@ -25,15 +29,15 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - if (!${{ github.ref_name }}) { + if (!${{ toJson(github.ref_name) }}) { core.setFailed("RELEASE_TAG is not defined.") return; } try { const response = await github.rest.repos.createRelease({ - name: ${{ github.ref_name }}, - tag_name: ${{ github.ref_name }}, + name: ${{ toJson(github.ref_name) }}, + tag_name: ${{ toJson(github.ref_name) }}, draft: false, generate_release_notes: true, owner: context.repo.owner,