Commit c28ce8de authored by Jan Kiene's avatar Jan Kiene
Browse files

actually look in other pageswhen searching for last job id

parent 067c99ef
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import argparse
import requests

PER_PAGE_SUFFIX = "?per_page=50"
PAGE_SUFFIX = "&page={}"
API_BASE_URL = "https://forge.3gpp.org/rep/api/v4/projects/49"


@@ -51,11 +52,12 @@ job_id = -1
# check last 500 pipelines max
for page in range(100):
    url_pls = API_BASE_URL + "/pipelines"
    resp_pls = requests.get(url_pls + PER_PAGE_SUFFIX)
    suffix = PER_PAGE_SUFFIX + PAGE_SUFFIX.format(page)
    resp_pls = requests.get(url_pls + suffix)
    for pl in resp_pls.json():
        if pl["ref"] == branch_name:
            url_jobs = url_pls + f"/{pl['id']}/jobs"
            resp_jobs = requests.get(url_jobs + PER_PAGE_SUFFIX)
            resp_jobs = requests.get(url_jobs + suffix)

            if job_name not in resp_jobs.text:
                continue