Skip to content

Commit

Permalink
feat(tests): update_fixtures.py: github run_id
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
mmilata committed Jun 6, 2024
1 parent 3760dd3 commit 6ff7322
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ def get_branch_ui_fixtures_results(
branch_name: str,
only_jobs: Iterable[str] | None,
exclude_jobs: Iterable[str] | None,
run_id: int | None,
) -> dict[str, AnyDict]:
print(f"Checking branch {branch_name}")

response = requests.get(
LIST_RUNS_TEMPLATE.format(branch=branch_name, workflow="core.yml")
)
response.raise_for_status()
run_id = response.json()["workflow_runs"][0]["id"]
run_id = run_id or response.json()["workflow_runs"][0]["id"]

def yield_key_value() -> Iterator[tuple[str, AnyDict]]:
for model in MODELS:
Expand Down
6 changes: 5 additions & 1 deletion tests/update_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def _get_current_git_branch() -> str:
help="Fetch from GitHub Actions instead of GitLab CI",
)
@click.option("-b", "--branch", help="Branch name")
@click.option("-r", "--run-id", help="GitHub Actions run id", type=int)
@click.option(
"-o",
"--only-jobs",
Expand All @@ -58,6 +59,7 @@ def _get_current_git_branch() -> str:
def ci(
github: bool,
branch: str | None,
run_id: int | None,
only_jobs: Iterable[str] | None,
exclude_jobs: Iterable[str] | None,
remove_missing: bool,
Expand All @@ -80,7 +82,9 @@ def ci(
if github:
from github import get_branch_ui_fixtures_results

ui_results = get_branch_ui_fixtures_results(branch, only_jobs, exclude_jobs)
ui_results = get_branch_ui_fixtures_results(
branch, only_jobs, exclude_jobs, run_id
)
else:
from gitlab import get_branch_ui_fixtures_results, get_jobs_of_interest

Expand Down

0 comments on commit 6ff7322

Please sign in to comment.