Skip to content

Commit edaf98b

Browse files
authored
fix the action (#6)
* explicitly install more-itertools * temporarily set the max chars limit to 15 * fix the last-resort summary * fix the fix * print the json log for debugging * add the shell * get the python version from sys.version_info * set the max_chars to 200 * set the character limit to 400 * revert back to the character limit of github issues * wrap the json log in a output group * add some environment information
1 parent 4dfec43 commit edaf98b

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

action.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,21 @@ runs:
2525
using: composite
2626
# TODO: learn enough javascript / node.js to write the reportlog parsing
2727
steps:
28+
- name: print environment information
29+
shell: bash
30+
run: |
31+
python --version
32+
python -m pip list
2833
- name: install dependencies
2934
shell: bash
3035
run: |
31-
python -m pip install pytest
36+
python -m pip install pytest more-itertools
37+
- name: print the json log
38+
shell: bash
39+
run: |
40+
echo "::group::json log"
41+
cat ${{ inputs.log-path }}
42+
echo "::endgroup::"
3243
- name: produce the issue body
3344
shell: bash
3445
run: |

parse_logs.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55
import pathlib
66
import re
7+
import sys
78
import textwrap
89
from dataclasses import dataclass
910

@@ -146,8 +147,9 @@ def truncate(reports, max_chars, **formatter_kwargs):
146147
return None
147148

148149

149-
def summarize(reports):
150-
return f"{len(reports)} failing tests"
150+
def summarize(reports, **formatter_kwargs):
151+
summary = [f"{len(reports)} failing tests"]
152+
return format_report(summary, **formatter_kwargs)
151153

152154

153155
def compressed_report(reports, max_chars, **formatter_kwargs):
@@ -167,15 +169,15 @@ def compressed_report(reports, max_chars, **formatter_kwargs):
167169
if formatted is not None and len(formatted) <= max_chars:
168170
return formatted
169171

170-
return summarize(reports)
172+
return summarize(reports, **formatter_kwargs)
171173

172174

173175
if __name__ == "__main__":
174176
parser = argparse.ArgumentParser()
175177
parser.add_argument("filepath", type=pathlib.Path)
176178
args = parser.parse_args()
177179

178-
py_version = args.filepath.stem.split("-")[1]
180+
py_version = ".".join(str(_) for _ in sys.version_info[:2])
179181

180182
print("Parsing logs ...")
181183

0 commit comments

Comments
 (0)