Skip to content

actionlint returns fatal error on run: script with broken Python code #411

@rhysd

Description

@rhysd

Repro

on: push
jobs:
  step-level:
    runs-on: ubuntu-latest
    steps:
      - run: print(
        shell: python

Install pyflakes and run actionlint for the workflow:

actionlint test.yaml

Expected behavior

The syntax error in run: script should be printed as a lint error reported from actionlint:

test.yaml:6:9: pyflakes reported issue in this script: 1:7: unexpected EOF while parsing [pyflakes]
   |
10 |       - run: print(
   |         ^~~~

Actual behavior

actionlint reports a fatal error instead:

`/path/to/pyflakes` did not run successfully while checking script at line:6,col:9: /path/to/pyflakes.exe exited with status 1 but stdout was empty. stderr: "<stdin>:1:7: unexpected EOF while parsing\r\nprint(\r\n      ^\r\n"

Other information

This is because pyflakes usually reports the lint errors to stdout, but it reports syntax errors to stderr. In addition, the syntax errors are reported with multiple lines but actionlint assumes that every error from pyflakes is reported in a single line. The error output parser needs to be updated as well.

> echo 'print(' | pyflakes
<stdin>:1:7: unexpected EOF while parsing
print(
      ^

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions