Skip to content

Commit

Permalink
fix: add filtering for runs by branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-neon committed Jun 21, 2024
1 parent 2e38715 commit 0b2fee8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,13 @@ def get_runs_by_workflow_id(
return result


def get_runs_count(session: requests.Session, created_time: str = datetime.now().strftime(DATE_FORMAT)):
def get_runs_count(session: requests.Session, created_time: str = datetime.now().strftime(DATE_FORMAT), ref: str = "main"):
"""
Get all runs for Tracer CI from particular date.
"""
payload = {"created": created_time}
resp = session.get("https://api.github.com/repos/neonlabsorg/tracer-api/actions/runs", params=payload).json()
return resp["total_count"]
resp = session.get(f"https://api.github.com/repos/neonlabsorg/tracer-api/actions/runs?branch={ref}", params=payload).json()
return len([run for run in resp["workflow_runs"]])


def run_workflow(
Expand Down Expand Up @@ -551,7 +551,7 @@ def trigger_tracer_tests(ref, neon_tests_image, proxy_image_tag, proxy_image_nam
workflow_id = find_workflow_id_by_key(workflows, "name", "tracer api main pipeline")

runs_before_start = get_runs_by_workflow_id(session, workflow_id, created_time)
runs_count = get_runs_count(session, created_time)
runs_count = get_runs_count(session, created_time, ref)

run_workflow(
session,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ jobs:
run: |
python3 ./.github/workflows/deploy.py trigger_tracer_tests --proxy_image_tag=${{ needs.build-image.outputs.proxy_tag }} \
--evm_loader_image_tag=${{ needs.build-image.outputs.neon_evm_tag }} \
--token=${{ secrets.GHTOKEN }} --ref=update_hardcoded_proxy_image_name
--token=${{ secrets.GHTOKEN }}
- name: Cancel the build if job failed
if: "failure()"
uses: "andymckay/cancel-action@0.4"
Expand Down

0 comments on commit 0b2fee8

Please sign in to comment.