Skip to content

Commit

Permalink
Remove lines break from job name
Browse files Browse the repository at this point in the history
  • Loading branch information
arponpes committed Mar 13, 2023
1 parent c374bd9 commit 0edde0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def process_workflow_job():

job_id = job["workflow_job"]["id"]
run_id = job["workflow_job"]["run_id"]
job_name = job["workflow_job"]["name"]
job_name = job["workflow_job"]["name"].replace("\n", " ")
workflow = job["workflow_job"]["workflow_name"]
time_start = parse_datetime(job["workflow_job"]["started_at"])
branch = job["workflow_job"].get("head_branch", "")
Expand Down
15 changes: 15 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,18 @@ def test_logging_flow_queued_after_in_progress(client, caplog):
"job_name=Build workflow=CI requestor=testerbot runner_name= runner_public=false "
"repository_private=false"
)


def test_line_break_in_job_name(client, caplog):
body = BODY.copy()
body["action"] = "queued"
body["workflow_job"][
"name"
] = "Build and push images (actions-runner-dind, NPROC=2\n, runner-images/devops/actions-runner-dind, l..."
response = client.post("/github-webhook", headers=HEADERS, json=body)
assert response.status_code == 200
assert caplog.messages == [
'action=queued repository=foo/foo branch=new-feature-branch job_id=6 run_id=10 job_name="Build and push '
'images (actions-runner-dind, NPROC=2 , runner-images/devops/actions-runner-dind, l..."'
' workflow=CI requestor=testerbot'
]

0 comments on commit 0edde0b

Please sign in to comment.