Skip to content

Commit

Permalink
Change: Rename GitHub workflow API
Browse files Browse the repository at this point in the history
Rename get_workflow_artifacts to get_workflow_run_artifacts to have a
consistent naming.
  • Loading branch information
bjoernricks committed Sep 27, 2022
1 parent 4ba835a commit a6f9378
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pontos/github/api/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ def download_repository_artifact(
api = f"{self.url}/repos/{repo}/actions/artifacts/{artifact}/zip"
return download(api, destination, headers=self._request_headers())

def get_workflow_artifacts(
self, repo: str, workflow: str
def get_workflow_run_artifacts(
self, repo: str, run: str
) -> Iterable[JSON_OBJECT]:
"""
List all artifacts for a workflow run
Args:
repo: GitHub repository (owner/name) to use
workflow: The unique identifier of the workflow run
run: The unique identifier of the workflow run
Raises:
HTTPStatusError: A httpx.HTTPStatusError is raised if the request
Expand All @@ -108,7 +108,7 @@ def get_workflow_artifacts(
Returns:
Information about the artifacts in the workflow as a dict
"""
api = f"/repos/{repo}/actions/runs/{workflow}/artifacts"
api = f"/repos/{repo}/actions/runs/{run}/artifacts"
return self._get_paged_items(api, "artifacts")

def delete_repository_artifact(self, repo: str, artifact: str):
Expand Down
8 changes: 4 additions & 4 deletions tests/github/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def test_download_repository_artifact(
next(it)

@patch("pontos.github.api.api.httpx.get")
def test_get_workflow_artifacts(self, requests_mock: MagicMock):
def test_get_workflow_run_artifacts(self, requests_mock: MagicMock):
response = MagicMock()
response.links = None
response.json.return_value = {
Expand All @@ -873,7 +873,7 @@ def test_get_workflow_artifacts(self, requests_mock: MagicMock):
}
requests_mock.return_value = response
api = GitHubRESTApi("12345")
artifacts = api.get_workflow_artifacts("foo/bar", "123")
artifacts = api.get_workflow_run_artifacts("foo/bar", "123")

args, kwargs = default_request(
"https://api.github.com/repos/foo/bar/actions/runs/123/artifacts",
Expand All @@ -885,7 +885,7 @@ def test_get_workflow_artifacts(self, requests_mock: MagicMock):
self.assertEqual(artifacts[0]["name"], "Foo")

@patch("pontos.github.api.api.httpx.get")
def test_get_workflow_artifacts_with_pagination(
def test_get_workflow_run_artifacts_with_pagination(
self, requests_mock: MagicMock
):
response = MagicMock()
Expand Down Expand Up @@ -914,7 +914,7 @@ def test_get_workflow_artifacts_with_pagination(
]
requests_mock.return_value = response
api = GitHubRESTApi("12345")
artifacts = api.get_workflow_artifacts("foo/bar", "123")
artifacts = api.get_workflow_run_artifacts("foo/bar", "123")

args1, kwargs1 = default_request(
"https://api.github.com/repos/foo/bar/actions/runs/123/artifacts",
Expand Down

0 comments on commit a6f9378

Please sign in to comment.