Skip to content

Commit 45ccec7

Browse files
authored
PTFE-1981 fix mistakes with API schema (#210)
1 parent 3bd9b89 commit 45ccec7

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

bert_e/git_host/github/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,6 @@ def remove_unwanted_workflows(self):
654654
self._workflow_runs
655655
))
656656

657-
self._workflow_runs = list(filter(
658-
lambda elem: elem['app']['slug'] == 'github-actions',
659-
self._workflow_runs
660-
))
661-
662657
# When two of the same workflow ran on the same branch,
663658
# we only keep the best one.
664659
conclusion_ranking = {

bert_e/git_host/github/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ class WorkflowRun(GitHubSchema):
137137
head_sha = fields.Str()
138138
head_branch = fields.Str()
139139
status = fields.Str()
140+
conclusion = fields.Str(allow_none=True)
140141
check_suite_id = fields.Integer()
141142
html_url = fields.Str()
142143
event = fields.Str()
144+
workflow_id = fields.Integer()
143145

144146

145147
class AggregateWorkflowRuns(GitHubSchema):

bert_e/tests/images/github-mock/Dockerfile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,8 @@ RUN curl https://github.com/stoplightio/prism/releases/download/${PRISM_VERSION}
1515

1616
WORKDIR /app
1717

18-
RUN curl -O -L https://raw.githubusercontent.com/github/rest-api-description/a2f6c1ddb1840778cf7a4119c4446d697f77500e/descriptions/ghec/ghec.2022-11-28.json
19-
20-
# There's a misconfiguration in the openapi file, we are going to replace the following strings:
21-
# - "server-statistics-actions.yaml" -> "#/components/schemas/server-statistics-actions"
22-
# - "server-statistics-packages.yaml" -> "#/components/schemas/server-statistics-packages"
23-
24-
RUN sed -i 's/server-statistics-actions.yaml/#\/components\/schemas\/server-statistics-actions/g' ghec.2022-11-28.json \
25-
&& sed -i 's/server-statistics-packages.yaml/#\/components\/schemas\/server-statistics-packages/g' ghec.2022-11-28.json
18+
RUN curl -O -L https://raw.githubusercontent.com/github/rest-api-description/refs/heads/main/descriptions/api.github.com/api.github.com.json
2619

2720
ENTRYPOINT [ "prism" ]
2821

29-
CMD ["mock", "ghec.2022-11-28.json", "-h", "0.0.0.0"]
22+
CMD ["mock", "api.github.com.json", "-h", "0.0.0.0"]

bert_e/tests/unit/test_github_build_status.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ def workflow_run_json():
2828
'workflow_id': 1,
2929
'check_suite_id': 1,
3030
'conclusion': 'success',
31-
'app': {
32-
'slug': 'github-actions'
33-
},
3431
'pull_requests': [
3532
{
3633
'number': 1
@@ -53,9 +50,6 @@ def workflow_run_json():
5350
'event': 'pull_request',
5451
'status': 'completed',
5552
'conclusion': 'cancelled',
56-
'app': {
57-
'slug': 'github-actions'
58-
},
5953
'pull_requests': [
6054
{
6155
'number': 1
@@ -74,6 +68,19 @@ def workflow_run_json():
7468
}
7569

7670

71+
def test_aggregated_workflow_run_api_client(client):
72+
"""Run the workflow run client with the GitHub mock server."""
73+
workflow_runs = AggregatedWorkflowRuns.get(
74+
client=client,
75+
owner='octo-org',
76+
repo='Hello-World',
77+
params={
78+
'head_sha': 'd6fde92930d4715a2b49857d24b940956b26d2d3'
79+
}
80+
)
81+
assert workflow_runs.state == 'INPROGRESS'
82+
83+
7784
def test_aggregated_workflow_run(client, workflow_run_json):
7885
workflow_runs = AggregatedWorkflowRuns(client, **workflow_run_json)
7986

0 commit comments

Comments
 (0)