GitHub repository A contains a reusable GitHub action workflow where myscript is a bash script wrapper around a python dependency:
name: 'A'
[...]
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v4
with:
python-version: '3'
cache: 'pip'
- run: pip install -r requirements.txt
shell: bash
- run: myscript
shell: bash
Now in repository B I reuse that action:
name: 'B'
on:
workflow_dispatch:
push:
branches:
- master
jobs:
shacl:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and Validate
uses: username/repoa@v1
with: [...]
However now I get an error in the action log:
Run actions/setup-python@v4
with:
python-version: 3
cache: pip
check-latest: false
token: ***
update-environment: true
Successfully set up CPython (3.10.6)
Error: No file in /home/runner/work/ontology/ontology matched to [**/requirements.txt], make sure you have checked out the target repository
Now if this was only caused by the file being in the wrong repository this would be problematic enough, but the error even persists when completely removing any usage of requirements.txt:
[...]
runs:
using: 'composite'
steps:
- uses: actions/setup-python@v4
with:
python-version: '3'
cache: 'pip'
- run: pip install mydependency
shell: bash
[...]
The error will still occur, because setup-python will try to use requirements.txt for it's cache key and fail. There is a cache-dependency-path
attribute for setup-python but I don't have any file I can point it to because all the files are in repository A but I have checked out repository B.
How can I use actions/setup-python in a reusable workflow with caching without getting this error?