re-actors / alls-green

A check for whether the dependency jobs are all green.
https://github.com/marketplace/actions/alls-green
BSD 3-Clause "New" or "Revised" License
110 stars 12 forks source link

SyntaxError in normalize_needed_jobs_status.py #17

Closed BuddyGlas closed 1 year ago

BuddyGlas commented 1 year ago

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.

webknjaz commented 1 year ago

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.

BuddyGlas commented 1 year ago

@webknjaz Thank you! It helped.