re-actors/alls-green

SyntaxError in normalize_needed_jobs_status.py

Closed this issue · 2 comments

Hi
This is how I added your action to my workflow:

check:
    if: always()
    runs-on: [self-hosted]
    needs:
    - dev_build_int_tests

    steps:
    - name: Decide whether the needed jobs succeeded or failed
      uses: re-actors/alls-green@v1.2.2
      with:
        jobs: ${{ toJSON(needs) }}

And I got this error:

Traceback (most recent call last):
 File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
   mod_name, _Error)
 File "/usr/lib/python2.7/runpy.py", line 119, in _get_module_details
   code = loader.get_code(mod_name)
 File "/usr/lib/python2.7/pkgutil.py", line 281, in get_code
   self.code = compile(source, self.filename, 'exec')
 File "/opt/actions-runner/_work/_actions/re-actors/alls-green/v1.2.2/src/normalize_needed_jobs_status.py", line 29
   write_lines_to_streams((f'{name}={value}',), (outputs_file,))
                                           ^
SyntaxError: invalid syntax
Error: Process completed with exit code 1.

Could you help me to fix it, please.

This syntax requires Python 3.6+. You could inject an actions/setup-python@v4 action, switching your job's Python to v3, as a workaround. I think that all the shared runners on the public GitHub platform already default to Python 3.

@webknjaz Thank you! It helped.