ci: add GH_TOKEN environment variable for GitHub CLI authentication in workflow

This commit is contained in:
chenhaoran 2025-03-13 09:53:16 +08:00
parent ad7afcc437
commit cf3582b964
1 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,8 @@ jobs:
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
@ -19,4 +21,4 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "PR has been merged or closed, cancelling workflow..."
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 {}
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 }} {}