Skip to content

Commit

Permalink
[PTFE-215] 🐛 Workflow job error 500 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspardmoindrot authored May 26, 2023
1 parent 89f3cfb commit 16c0b9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gh_actions_exporter/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def relabel_job_labels(

def relabel_job_names(self, relabel: Relabel, job: WorkflowJob) -> dict:
result = {relabel.label: relabel.default}
if job.status == "queued":
if job.status == "queued" or job.conclusion == "skipped":
result[relabel.label] = ""
else:
for label in relabel.values:
Expand Down
9 changes: 9 additions & 0 deletions tests/api/metrics/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,12 @@ def test_job_cost(client, workflow_job, headers):
for line in metrics.text.split("\n"):
if "github_actions_job_cost_count_total{" in line:
assert "0.104" in line


def test_skipped_job(override_job_config, client, workflow_job, headers):
workflow_job["workflow_job"]["runner_name"] = None
workflow_job["workflow_job"]["status"] = "completed"
workflow_job["workflow_job"]["conclusion"] = "skipped"
workflow_job["workflow_job"]["completed_at"] = "2021-11-29T14:59:57Z"
response = client.post("/webhook", json=workflow_job, headers=headers)
assert response.status_code == 202

0 comments on commit 16c0b9f

Please sign in to comment.