Make a request to github api instead of using composite action (#2558)

This commit is contained in:
Gusev Yaroslav 2023-12-11 15:24:26 +07:00 committed by GitHub
parent 5515c3b534
commit ea2be754e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View file

@ -11,6 +11,8 @@ jobs:
check-for-no-version-changing:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
actions: write
steps:
# Checkout to target branch
- uses: actions/checkout@v2
@ -33,10 +35,14 @@ jobs:
# Stop workflow and do not bump version if it was changed already
- name: Stop workflow if version was changed already
uses: styfle/cancel-workflow-action@0.12.0
if: steps.packageOld.outputs.version != steps.packageNew.outputs.version
with:
workflow_id: ${{ github.run_id }}
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
bump-version:
needs: check-for-no-version-changing

View file

@ -11,6 +11,8 @@ jobs:
check-version-changing:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/setup-node@v3
with:
@ -36,10 +38,14 @@ jobs:
# Stop workflow if version was not changed
- name: Stop workflow if version was not changed
uses: styfle/cancel-workflow-action@0.12.0
if: steps.packageOld.outputs.version == steps.packageNew.outputs.version
with:
workflow_id: ${{ github.run_id }}
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel
# Create a new draft release
release-draft: