Merge pull request #64293 from ClickHouse/ci_changelog_py_fix

CI: dependency fix for changelog.py
This commit is contained in:
Max K 2024-05-23 13:42:29 +00:00 committed by GitHub
commit 9fb8c8263f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -45,6 +45,7 @@ from env_helper import (
S3_BUILDS_BUCKET,
TEMP_PATH,
GITHUB_RUN_ID,
GITHUB_REPOSITORY,
)
from get_robot_token import get_best_robot_token
from git_helper import GIT_PREFIX, Git
@ -1913,7 +1914,7 @@ def _cancel_pr_wf(s3: S3Helper, pr_number: int) -> None:
print(f"ERROR: FIX IT: Run id has not been found PR [{pr_number}]!")
else:
print(f"Canceling PR workflow run_id: [{run_id}], pr: [{pr_number}]")
GitHub.cancel_wf(run_id)
GitHub.cancel_wf(GITHUB_REPOSITORY, get_best_robot_token(), run_id)
def main() -> int:

View File

@ -22,9 +22,6 @@ from github.NamedUser import NamedUser as NamedUser
from github.PullRequest import PullRequest as PullRequest
from github.Repository import Repository as Repository
from env_helper import GITHUB_REPOSITORY
from get_robot_token import get_best_robot_token
# pylint: enable=useless-import-alias
CACHE_PATH = p.join(p.dirname(p.realpath(__file__)), "gh_cache")
@ -265,12 +262,11 @@ class GitHub(github.Github):
assert isinstance(value, int)
self._retries = value
# minimalistic static methods not using pygithub
# static methods not using pygithub
@staticmethod
def cancel_wf(run_id, strict=False):
token = get_best_robot_token()
def cancel_wf(repo, run_id, token, strict=False):
headers = {"Authorization": f"token {token}"}
url = f"https://api.github.com/repos/{GITHUB_REPOSITORY}/actions/runs/{run_id}/cancel"
url = f"https://api.github.com/repos/{repo}/actions/runs/{run_id}/cancel"
try:
response = requests.post(url, headers=headers, timeout=10)
response.raise_for_status()