Unverified Commit 037f378d authored by Protocole's avatar Protocole
Browse files

ci(notify): fix notify for new jobs

parent c3384502
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -54,13 +54,15 @@ def generate_data(name: str, version: str, changelog: str, stage: str):
    #send an http GET request to the quotes url
    job_url="{0}{1}/{2}".format(API_JOBS_LINK, R2_BOT_USER, name.lower())
    job_metadata_request=requests.get(job_url)
    icon = "🏷"

    if job_metadata_request.status_code != 200:
        logging.error("[ERROR] Job %s not found for user %s with request %s", name.lower(), R2_BOT_USER, job_url)
        sys.exit(1)

        logging.error("[WARN] Job %s not found for user %s with request %s", name.lower(), R2_BOT_USER, job_url)
        logging.error("[WARN] In order to proceed, we are replacing the job icon by default: 🏷")
    else:
        icon = job_metadata_request.json()["icon"]


    data_format = {
        "username": USERNAME,
        "avatar_url": AVATAR_URL,
@@ -113,6 +115,7 @@ def send_message(web_hook: str, data_format: object):

    if result.status_code != 204:
       logging.error("[ERROR] A problem occured when sending discord message for this release")
       logging.error("[ERROR] Returned error code: %d", result.status_code)
       logging.error("[ERROR] Result body: %s", result.text)
       sys.exit(1)