You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be great to have a formatter that, when run in a GitHub action, formats the output in a way that can be understood by the runner and shows warnings in PRs. The format required is defined here
The text was updated successfully, but these errors were encountered:
I ended up doing a quick-and-dirty python script that does what I needed:
#!/usr/bin/env python3# -*- coding: utf-8 -*-'''Runs drstring and formats the output for GitHub Actions'''importosimportargparsefromsubprocessimportPIPE, PopenimportredefconvertToGitHubActionsOutput(line: str, current_directory: str):
regex=re.compile('^(.+?):(.+?):(.+?):(.+?):(.+)$')
matches=regex.findall(line)[0]
filename=matches[0].replace(current_directory, "")[1:]
returnf"::warning file={filename},line={matches[1]},col={matches[2]},endColumn={matches[2]}::{matches[4].strip()}"# Parse argument for pathparser=argparse.ArgumentParser(description="Runs drstring and formats the output for GitHub Actions")
parser.add_argument('config_file', type=str, help='The path to the config file for drstring')
parser.add_argument('root_path', type=str, help='The path to the root of the project')
args=parser.parse_args()
# Run drstringresult=Popen(f"drstring check --config-file {args.config_file}", shell=True, stdout=PIPE, stderr=PIPE)
stdout, _=result.communicate()
# Clean output into list of errorscleaned_output=list(filter(None, stdout.decode('UTF-8').split("\n")))
# Map list of errors into something github actions understandsgh_output= [convertToGitHubActionsOutput(line, args.root_path) forlineincleaned_output]
forlineingh_output:
print(line)
Would be great to have a formatter that, when run in a GitHub action, formats the output in a way that can be understood by the runner and shows warnings in PRs. The format required is defined here
The text was updated successfully, but these errors were encountered: