Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit aefa6b7

Browse files
authored
Remove lines break from job name (#17)
Remove lines break from job name
1 parent c374bd9 commit aefa6b7

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = github-workflows-monitoring
3-
version = 0.1.2
3+
version = 0.1.3
44
license-file = LICENSE
55

66
[options]

src/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def process_workflow_job():
4949

5050
job_id = job["workflow_job"]["id"]
5151
run_id = job["workflow_job"]["run_id"]
52-
job_name = job["workflow_job"]["name"]
52+
job_name = job["workflow_job"]["name"].replace("\n", " ")
5353
workflow = job["workflow_job"]["workflow_name"]
5454
time_start = parse_datetime(job["workflow_job"]["started_at"])
5555
branch = job["workflow_job"].get("head_branch", "")

tests/tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,18 @@ def test_logging_flow_queued_after_in_progress(client, caplog):
182182
"job_name=Build workflow=CI requestor=testerbot runner_name= runner_public=false "
183183
"repository_private=false"
184184
)
185+
186+
187+
def test_line_break_in_job_name(client, caplog):
188+
body = BODY.copy()
189+
body["action"] = "queued"
190+
body["workflow_job"][
191+
"name"
192+
] = "Build and push images (actions-runner-dind, NPROC=2\n, runner-images/devops/actions-runner-dind, l..."
193+
response = client.post("/github-webhook", headers=HEADERS, json=body)
194+
assert response.status_code == 200
195+
assert caplog.messages == [
196+
'action=queued repository=foo/foo branch=new-feature-branch job_id=6 run_id=10 job_name="Build and push '
197+
'images (actions-runner-dind, NPROC=2 , runner-images/devops/actions-runner-dind, l..."'
198+
' workflow=CI requestor=testerbot'
199+
]

0 commit comments

Comments
 (0)