ZedThree / clang-tidy-review

Create a pull request review based on clang-tidy warnings
MIT License
90 stars 45 forks source link

Download artefacts as part of `post` workflow #55

Closed ZedThree closed 1 year ago

ZedThree commented 2 years ago

Wrap up the steps needed to download the review artefact, extract the comments, and post them, into a composite workflow.

This might be easier with #53 or by creating a python package so that we don't need to build a docker image.

ZedThree commented 1 year ago

Actually, this can be done in pure python:

# workflow id is an input: ${{github.event.workflow_run.id }}
workflow = repo.get_workflow_run(workflow_id)
for artifact in workflow.get_artifacts():
  if artifact.name == "clang-tidy-review":
     break

r = requests.get(artifact.archive_download_url,  headers={"Authorization": f"token {token}")

contents = b"".join(r.iter_content())

zipfile.ZipFile(io.BytesIO(contents)).extractall()