From ea2be754e7df0ff731a71fff468b86743f19fd98 Mon Sep 17 00:00:00 2001 From: Gusev Yaroslav <59017579+GoldenJaden@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:24:26 +0700 Subject: [PATCH] Make a request to github api instead of using composite action (#2558) --- .github/workflows/bump-version-on-merge-next.yml | 12 +++++++++--- .github/workflows/create-a-release-draft.yml | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bump-version-on-merge-next.yml b/.github/workflows/bump-version-on-merge-next.yml index d480e57c..3cfa5e1c 100644 --- a/.github/workflows/bump-version-on-merge-next.yml +++ b/.github/workflows/bump-version-on-merge-next.yml @@ -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 diff --git a/.github/workflows/create-a-release-draft.yml b/.github/workflows/create-a-release-draft.yml index 687f12b6..c4c5d332 100644 --- a/.github/workflows/create-a-release-draft.yml +++ b/.github/workflows/create-a-release-draft.yml @@ -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: