diff --git a/.github/workflows/deploy.py b/.github/workflows/deploy.py index 19d3f922..43f3e292 100644 --- a/.github/workflows/deploy.py +++ b/.github/workflows/deploy.py @@ -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( @@ -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, diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index d1bc8502..c391ee06 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -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"