Skip to content

Remove lines break from job name #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = github-workflows-monitoring
version = 0.1.2
version = 0.1.3
license-file = LICENSE

[options]
Expand Down
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'
]