Gr1N / setup-poetry

Set up your GitHub Actions workflow with a specific version of Poetry
MIT License
87 stars 14 forks source link

Action failing on locally hosted Gitea Repo #47

Open mario-dg opened 6 months ago

mario-dg commented 6 months ago

I'm trying to use this Action in a repo that is hosted on local Gitea Instance of my company. When I tested the workflow using act_runner (as specified by Gitea) everything is working, but as soon as I try to run the work via a trigger, setup-poetry is not working and failing with following error:

Unexpected error attempting to determine if executable file exists 'C:\Users\MYUSER\AppData\Local\Microsoft\WindowsApps\python.EXE': Error: EACCES: permission denied, stat 'C:\Users\MYUSER\AppData\Local\Microsoft\WindowsApps\python.EXE'
Unexpected error attempting to determine if executable file exists 'C:\Users\MYUSER\AppData\Local\Microsoft\WindowsApps\python.EXE': Error: EACCES: permission denied, stat 'C:\Users\MYUSER\AppData\Local\Microsoft\WindowsApps\python.EXE'
[command]C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\python.exe C:\Users\MYUSER\.cache\act\7a6d1ebeca19b951\tmp\6ba4e6bd-d33c-4a70-8500-7999a9a9611a --yes
Retrieving Poetry metadata
Traceback (most recent call last):
  File "C:\Users\MYUSER\.cache\act\7a6d1ebeca19b951\tmp\6ba4e6bd-d33c-4a70-8500-7999a9a9611a", line 945, in <module>
    sys.exit(main())
             ^^^^^^
  File "C:\Users\MYUSER\.cache\act\7a6d1ebeca19b951\tmp\6ba4e6bd-d33c-4a70-8500-7999a9a9611a", line 9[2](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-2)3, in main
    return installer.run()
           ^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\.cache\act\7a6d1ebeca19b951\tmp\6ba4e6bd-d33c-4a70-8500-7999a9a9611a", line 524, in run
    version, current_version = self.get_version()
                               ^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\.cache\act\7a6d1ebeca19b951\tmp\6ba4e6bd-d[3](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-3)3c-4a70-8500-7999a9a9611a", line 786, in get_version
    metadata = json.loads(self._get(self.METADATA_URL).decode())
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\.cache\act\7a6d1ebeca19b951\tmp\6ba[4](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-4)e6bd-d33c-4a70-8500-7999a9a9611a", line 847, in _get
    with closing(urlopen(request)) as r:
                 ^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line [5](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-5)19, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 541, in _open
    return self._call_chain(self.handle_open, 'unknown',
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 49[6](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-6), in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Users\MYUSER\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 141[9](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-9), in unknown_open
    raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: https>
::error::The process 'C:\Users\MYUSER\AppData\Local\Programs\Python\Python3[11](https://MYURL/MYORG/MYREPO/actions/runs/1#jobstep-3-11)\python.exe' failed with exit code 1

This is how my workflow file looks like, pretty simple.

name: Any name

on:
  push

jobs:
  publish:
    name: Publish
    runs-on: windows
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          submodules: 'recursive'
      - name: Set up Python environment
        uses: actions/setup-python@v5
        id: cp311
        with:
          python-version: "3.11"
          update-environment: false
      - uses: Gr1N/setup-poetry@v9
      - name: Build with poetry
        run: |
          poetry build         

I haven't looked closely into your implementation yet, but a solution might be to allow the setup-poetry action to receive a path to a python.exe via its inputs? Specifically to leverage the previous steps setup-python output variable ${{ steps.cp311.outputs.python-path }} to allow a modification of the workflow to look like following:

name: Any name

on:
  push

jobs:
  publish:
    name: Publish
    runs-on: windows
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          submodules: 'recursive'
      - name: Set up Python environment
        uses: actions/setup-python@v5
        id: cp311
        with:
          python-version: "3.11"
          update-environment: false
      - uses: Gr1N/setup-poetry@v9
        with:
          python-path: ${{ steps.cp311.outputs.python-path }}
      - name: Build with poetry
        run: |
          poetry build