Skip to content

Commit 4d063f3

Browse files
committed
Make return code dependant on flake8 outcome.
1 parent bf5131f commit 4d063f3

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

flake8_github_action/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
# stdlib
3030
import json
31-
from typing import List, Union
31+
from typing import List, Tuple, Union
3232

3333
# 3rd party
3434
import click
@@ -57,7 +57,7 @@ def action(
5757
token: Union[str, Secret],
5858
repo: Union[str, URL, None] = None,
5959
*args,
60-
) -> Response:
60+
) -> Tuple[Response, int]:
6161
r"""
6262
Action!
6363
@@ -115,8 +115,10 @@ def action(
115115

116116
if flake8_app.result_count:
117117
conclusion = "failure"
118+
ret = 1
118119
else:
119120
conclusion = "success"
121+
ret = 0
120122

121123
for chunk in annotation_chunks[:-1]:
122124
check.update_check_run(
@@ -137,7 +139,7 @@ def action(
137139
"summary": "Output from Flake8",
138140
"annotations": [a.to_dict() for a in annotation_chunks[-1]],
139141
},
140-
)
142+
), ret
141143

142144

143145

flake8_github_action/__main__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ def main(ctx: click.Context, token: str, repo: Union[str, URL, None] = None):
7070
# this package
7171
from flake8_github_action import action
7272

73-
response = action(token, repo, *ctx.args)
73+
response, ret = action(token, repo, *ctx.args)
7474

75-
if response.status_code == 200:
76-
sys.exit(0)
75+
# if response.status_code == 200:
76+
# sys.exit(0)
77+
sys.exit(ret)
7778

7879

7980
if __name__ == "__main__":

0 commit comments

Comments
 (0)