From c82f9c1335605074bff208131df4f08fee292c3e Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 9 Oct 2024 10:01:51 -0400 Subject: [PATCH] Rename parameter to make it clear it is a github token --- .github/workflows/cancel_workflows_for_pr.yaml | 2 +- scripts/tools/cancel_workflows_for_pr.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cancel_workflows_for_pr.yaml b/.github/workflows/cancel_workflows_for_pr.yaml index ee2035017d6daa..c8b23b6de70ba5 100644 --- a/.github/workflows/cancel_workflows_for_pr.yaml +++ b/.github/workflows/cancel_workflows_for_pr.yaml @@ -52,4 +52,4 @@ jobs: scripts/tools/cancel_workflows_for_pr.py \ --pull-request ${{ inputs.pull_request_id }} \ --commit-sha "${{ inputs.commit_sha }}" \ - --token "${{ secrets.GITHUB_TOKEN }}" + --gh-api-token "${{ secrets.GITHUB_TOKEN }}" diff --git a/scripts/tools/cancel_workflows_for_pr.py b/scripts/tools/cancel_workflows_for_pr.py index b8d4670d0202fc..d06a67edb93908 100755 --- a/scripts/tools/cancel_workflows_for_pr.py +++ b/scripts/tools/cancel_workflows_for_pr.py @@ -65,20 +65,20 @@ def cancel_all_runs(self, pr_number, commit_sha, dry_run): ) @click.option("--pull-request", type=int, help="Pull request number to consider") @click.option("--commit-sha", help="Commit to look at when cancelling pull requests") -@click.option("--token", help="Github token to use") +@click.option("--gh-api-token", help="Github token to use") @click.option("--token-file", help="Read github token from the given file") @click.option("--dry-run", default=False, is_flag=True, help="Actually cancel or not") -def main(log_level, pull_request, commit_sha, token, token_file, dry_run): +def main(log_level, pull_request, commit_sha, gh_api_token, token_file, dry_run): coloredlogs.install( level=__LOG_LEVELS__[log_level], fmt="%(asctime)s %(levelname)-7s %(message)s" ) - if token: - gh_token = token + if gh_api_token: + gh_token = gh_api_token elif token_file: gh_token = open(token_file, "rt").read().strip() else: - raise Exception("Require a --token or --token-file to access github") + raise Exception("Require a --gh-api-token or --token-file to access github") Canceller(gh_token).cancel_all_runs(pull_request, commit_sha, dry_run)