Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement method to obtain logs download link from workflow run #2898

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonapich
Copy link

@jonapich jonapich commented Feb 8, 2024

This implements 2 new endpoints:

  • Get download link for workflow run (latest attempt)
  • Get download link for workflow run (WorkflowRun instance's attempt)

I also supplied a quick example of how to consume this download link, but I'm open to include this as a separate "courtesy" function (e.g.: def get_logs_for_this_attempt() -> Dict[PurePath, str]: ...).

I wasn't able to record the tests because I need admin access to the repository. Can an admin do that for me? 馃ズ

github/WorkflowRun.py Outdated Show resolved Hide resolved
Co-authored-by: Enrico Minack <[email protected]>
@EnricoMi
Copy link
Collaborator

Looks like there is precedence for following the Location link to download file content:

PyGithub/github/Repository.py

Lines 2147 to 2149 in 0b8435f

# Handle 302 redirect response
if headers.get("status") == "302 Found" and headers.get("location"):
headers, data = self._requester.requestJsonAndCheck("GET", headers["location"], parameters=url_parameters)

@jonapich
Copy link
Author

Looks like there is precedence for following the Location link to download file content:

PyGithub/github/Repository.py

Lines 2147 to 2149 in 0b8435f

# Handle 302 redirect response
if headers.get("status") == "302 Found" and headers.get("location"):
headers, data = self._requester.requestJsonAndCheck("GET", headers["location"], parameters=url_parameters)

Doing it this way will prevent users from using a streaming response. Large files need a separate download method.

@jonapich jonapich requested a review from EnricoMi March 11, 2024 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants