Skip to content

Commit 2914177

Browse files
committed
Trim whitespace
1 parent 38ed8ca commit 2914177

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

scripts/release/update-release-assets.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
if TYPE_CHECKING:
1414
from github import WorkflowRun, Repository
15-
15+
1616

1717
script_path = Path(__file__).resolve()
1818
root_path = script_path.parent.parent.parent
@@ -30,7 +30,7 @@ def get_check_runs(self: Repository.Repository, ref: str, **kwargs: str) -> Pagi
3030
f"{self.url}/commits/{ref}/check-runs",
3131
firstParams=None,
3232
list_item="check_runs")
33-
33+
3434
Repository.Repository = MyRepository
3535

3636
from github import WorkflowRun, Artifact
@@ -51,7 +51,7 @@ def download_logs(self, path: Path) -> None:
5151
if self._requester._Requester__auth is not None: # type: ignore
5252
headers["Authorization"] = f"{self._requester._Requester__auth.token_type} {self._requester._Requester__auth.token}" # type: ignore
5353
headers["User-Agent"] = self._requester._Requester__userAgent # type: ignore
54-
54+
5555
resp = requests.get(url, headers=headers, allow_redirects=True)
5656

5757
if resp.status_code != 200:
@@ -70,7 +70,7 @@ def download_artifacts(self, path: Path) -> None:
7070
if self._requester._Requester__auth is not None: # type: ignore
7171
headers["Authorization"] = f"{self._requester._Requester__auth.token_type} {self._requester._Requester__auth.token}" # type: ignore
7272
headers["User-Agent"] = self._requester._Requester__userAgent # type: ignore
73-
73+
7474
resp = requests.get(artifact.archive_download_url, headers=headers, allow_redirects=True)
7575

7676
if resp.status_code != 200:
@@ -93,15 +93,15 @@ def download_artifact(self, name: str, path: Path) -> None:
9393
if self._requester._Requester__auth is not None: # type: ignore
9494
headers["Authorization"] = f"{self._requester._Requester__auth.token_type} {self._requester._Requester__auth.token}" # type: ignore
9595
headers["User-Agent"] = self._requester._Requester__userAgent # type: ignore
96-
96+
9797
resp = requests.get(artifact.archive_download_url, headers=headers, allow_redirects=True)
9898

9999
if resp.status_code != 200:
100100
raise Exception(f"Unable to download artifact ${artifact.name}. Received status code {resp.status_code} {resp.reason}")
101101

102102
with (path / f"{artifact.name}.zip").open("wb") as f:
103103
f.write(resp.content)
104-
104+
105105

106106
WorkflowRun.WorkflowRun = MyWorkflowRun
107107

@@ -133,7 +133,7 @@ def make(self, directory: Path, workflow_runs: List[WorkflowRun.WorkflowRun]) ->
133133
actions.append(FileAction(action_args))
134134
else:
135135
raise Exception(f"Unknown action type {action_type}")
136-
136+
137137
artifacts.append(ReleaseArtifact(artifact, actions, self.skip_checks))
138138

139139
for artifact in artifacts:
@@ -157,7 +157,7 @@ def run(self) -> List[Path]:
157157
print(f"Downloading logs for {workflow_run.name}")
158158
workflow_run.download_logs(Path(self.temp_workdir.name)) # type: ignore
159159
return list(map(Path, Path(self.temp_workdir.name).glob("**/*")))
160-
160+
161161
class WorkflowArtifactAction():
162162

163163
def __init__(self, workflow_runs: List[WorkflowRun.WorkflowRun], **kwargs: str) -> None:
@@ -180,7 +180,7 @@ def run(self) -> List[Path]:
180180
print(f"Downloading artifacts for {workflow_run.name} to {self.temp_workdir.name}")
181181
workflow_run.download_artifacts(Path(self.temp_workdir.name)) # type: ignore
182182
return list(map(Path, Path(self.temp_workdir.name).glob("**/*")))
183-
183+
184184
class ShellAction():
185185
def __init__(self, command: str, **kwargs: Any) -> None:
186186
self.command = command.strip()
@@ -202,7 +202,7 @@ def run(self) -> List[Path]:
202202
concrete_command = self._rewrite_command()
203203
subprocess.run(concrete_command, cwd=self.temp_workdir.name, check=True, shell=True)
204204
return list(map(Path, Path(self.temp_workdir.name).glob("**/*")))
205-
205+
206206
class FileAction():
207207
def __init__(self, path: Path) -> None:
208208
self.path = path
@@ -228,8 +228,8 @@ def make(self, directory: Path) -> Path:
228228
extension = "".join(self.name.suffixes)[1:]
229229
if not extension in ["zip", "tar", "tar.gz", "tar.bz2", "tar.xz"]:
230230
raise Exception(f"Artifact {self.name} is not a support archive file, but has multiple files associated with it!")
231-
232-
ext_format_map = {
231+
232+
ext_format_map = {
233233
"zip": "zip",
234234
"tar": "tar",
235235
"tar.gz": "gztar",
@@ -241,7 +241,7 @@ def make(self, directory: Path) -> Path:
241241
temp_dir_path = Path(temp_dir)
242242
for file in files:
243243
shutil.copy(file, temp_dir_path / file.name)
244-
244+
245245
return Path(shutil.make_archive(str(directory / self.name.with_suffix("")), ext_format_map[extension], root_dir=temp_dir_path))
246246

247247
def main(args: 'argparse.Namespace') -> int:
@@ -264,13 +264,13 @@ def main(args: 'argparse.Namespace') -> int:
264264
if len(pull_candidates) != 1:
265265
print(f"Error: expected exactly one PR for SHA {args.head_sha}, but found {len(pull_candidates)}", file=sys.stderr)
266266
return 1
267-
267+
268268
pull_request = pull_candidates[0]
269269

270270
if pull_request.state != "open":
271271
print(f"Error: PR {pull_request.url} is not open", file=sys.stderr)
272272
return 1
273-
273+
274274
print(f"Found PR {pull_request.url} based on {pull_request.base.ref}")
275275

276276
rc_branch_regex = r"^rc/(?P<version>.*)$"
@@ -302,7 +302,7 @@ def main(args: 'argparse.Namespace') -> int:
302302

303303
action_workflow_run_url_regex = r"^https://(?P<github_url>[^/]+)/(?P<owner>[^/]+)/(?P<repo>[^/]+)/actions/runs/(?P<run_id>\d+)$"
304304
action_workflow_job_run_url_regex = r"^https://(?P<github_url>[^/]+)/(?P<owner>[^/]+)/(?P<repo>[^/]+)/actions/runs/(?P<run_id>\d+)/job/(?P<job_id>\d+)$"
305-
305+
306306
workflow_runs: List[WorkflowRun.WorkflowRun] = []
307307
for check_run in check_runs: # type: ignore
308308
check_run = cast(CheckRun.CheckRun, check_run)
@@ -322,7 +322,7 @@ def main(args: 'argparse.Namespace') -> int:
322322
else:
323323
print(f"Unable to handle checkrun {check_run.name} with id {check_run.id} with {check_run.details_url}")
324324
return 1
325-
325+
326326
print("Filtering workflow runs to only include the latest run for each workflow.")
327327
workflow_runs_per_id: Dict[int, WorkflowRun.WorkflowRun] = {}
328328
for workflow_run in workflow_runs:

0 commit comments

Comments
 (0)