diff --git a/.github/workflows/cancel-workflow-on-merge.yml b/.github/workflows/cancel-workflow-on-merge.yml index 68c87cf24d..5147a5b204 100644 --- a/.github/workflows/cancel-workflow-on-merge.yml +++ b/.github/workflows/cancel-workflow-on-merge.yml @@ -8,17 +8,11 @@ jobs: cancel-workflow: runs-on: ubuntu-latest steps: - - name: Set up GitHub CLI - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "${{ secrets.GITHUB_TOKEN }}" > ~/.gh_token - gh auth login --with-token < ~/.gh_token - - name: Cancel Workflow if Merged or Closed if: ${{ github.event.pull_request.merged || github.event.pull_request.state == 'closed' }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo "PR has been merged or closed, cancelling workflow..." + gh auth login --with-token $GH_TOKEN gh run list --repo ${{ github.repository }} --branch ${{ github.event.pull_request.head.ref }} --workflow "TDengine Test" --status in_progress --json databaseId --jq '.[].databaseId' | xargs -I {} gh run cancel --repo ${{ github.repository }} {} \ No newline at end of file