Skip to content

Commit f1e0c43

Browse files
committed
Linting.
1 parent 4d063f3 commit f1e0c43

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

flake8_github_action/__init__.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,11 @@ def action(
131131
},
132132
)
133133

134-
return check.complete_check_run(
135-
check_run_id,
136-
conclusion="success", # TODO: reflect flake8 output
137-
output={
138-
"title": "Flake8 checks",
139-
"summary": "Output from Flake8",
140-
"annotations": [a.to_dict() for a in annotation_chunks[-1]],
141-
},
142-
), ret
143-
144-
145-
146-
134+
output = {
135+
"title": "Flake8 checks",
136+
"summary": "Output from Flake8",
137+
"annotations": [a.to_dict() for a in annotation_chunks[-1]],
138+
}
139+
140+
# TODO: reflect flake8 output
141+
return check.complete_check_run(check_run_id, conclusion="success", output=output), ret

flake8_github_action/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,3 @@ def main(ctx: click.Context, token: str, repo: Union[str, URL, None] = None):
7979

8080
if __name__ == "__main__":
8181
sys.exit(main(obj={}))
82-

flake8_github_action/checks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,14 @@ def find_run_for_action(self) -> int:
7676
url = API_GITHUB_COM / "repos" / self.owner / self.repository_name / "commits" / self.head_sha / "check-runs"
7777
headers = {**common_headers, "Authorization": f"token {self.token.value}"}
7878

79+
workflow_name = os.environ.get("GITHUB_WORKFLOW")
80+
7981
for check_run in url.get(headers=headers).json()["check_runs"]:
80-
if check_run["name"] == os.environ.get("GITHUB_WORKFLOW"):
82+
if check_run["name"] == workflow_name:
8183
return check_run["id"]
8284

85+
raise ValueError(f"Can't find a check run for workflow with name {workflow_name}")
86+
8387
def create_check_run(self) -> int:
8488
"""
8589
Create a check and return its ID.

0 commit comments

Comments
 (0)