-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Do not fail when caching on non-Python repositories #807
Comments
Maybe this issue will be addressed by: |
To bypass current - name: Hack setup-python cache
# XXX Create an empty requirements.txt if this file (or pyproject.toml) doesn't exist.
# This work around and issue with setup-python for non-Python projects, which ends up with ends up
# with this error:
#
# Run actions/[email protected]
# with:
# python-version: 3.12
# cache: pip
# Installed versions
# Successfully set up CPython (3.12.1)
# Error: No file in /home/runner/work/awesome-iam/awesome-iam matched to
# [**/requirements.txt or **/pyproject.toml], make sure you have checked out the target repository
#
# This has been reported at: https://github.com/actions/setup-python/issues/807
# In the future this might be addressed by: https://github.com/actions/setup-python/pull/762
# or https://github.com/actions/setup-python/issues/751
if: hashFiles('**/requirements.txt', '**/pyproject.toml') == ''
run: |
touch ./requirements.txt Source: kdeldycke/workflows@662a971 |
Hello @kdeldycke |
workaround for actions/setup-python#807 and simplifies Renovate Signed-off-by: Tom Plant <[email protected]>
Hello @kdeldycke, Thank you once again for creating this issue. We have investigated the issue and actions/setup-python action is trying to find a requirements.txt or pyproject.toml file to cache the Python dependencies, but it's not able to find it. This error is encountered because setup-python is designed to cache Python dependencies and it expects these files to be present in Python projects. If the project is a non Python project and does not have any Python dependencies to cache, no need to activate the cache in setup-python. We can remove the cache: pip line from the workflow file.
|
Thanks @aparnajyothi-y for the reply. What you are describing is how What I'm looking for is to discuss the possibility for |
@aparnajyothi-y This may be a silly question, but why does |
Hello @kdeldycke, setup-python action doesn't directly have any support for caching. However, caching dependencies in GitHub workflows, including Python dependencies specified in a requirements.txt file, can typically be done using the actions/cache action.For reusable workflows, you can define a workflow in one repository and reference that workflow in other repositories. However, the actions/cache action currently has some limitations when used in reusable workflows. As for caching of remote requirements.txt files, this would require some additional steps in your workflow:
Here's an example of how you might use actions/cache to cache pip packages: steps:
Hello @deslaughter, The fetch-depth: 0 option in the actions/checkout action is used to fetch all history for all branches and tags. This is often necessary when we need the full git history to perform certain operations, like calculating a version number based on the number of commits, generating a changelog, or similar tasks. |
Hello @kdeldycke, please confirm if the above-provided information clarifies your request. Thank you. |
@aparnajyothi-y no. Your answer is really low-quality and is just trying to avoid discussing the issue. Are you a LLM-based bot? |
Hello @kdeldycke, We have explained the work arounds that we can use with action/setup-python and actions/checkout. If the actual request is to implement this feature from setup-python, it needs more investigation. We will get back to you on this once we got some feedback. |
Add python-version: 3.11 to workflows. Use a hack to manage setup-python looking for requirements.txt. Refs: actions/setup-python#807 Closes #448
Add python-version: 3.11 to workflows. Use a hack to manage setup-python looking for requirements.txt. Refs: actions/setup-python#807 Closes #448
Also remove setup-python caching hacks. Refs: actions/setup-python#807 actions/setup-python#762 actions/setup-python#751 Reverts: 662a971 89d73b1 e8ef6db f65666c
Hi @aparnajyothi-y. I acknowledge the fact that For all others looking forward to have this solved, my advice is to get rid of |
Description:
I am trying to use
setup-python
in a non Python repository. But I soon as I activate the cache, it ends up with this error:Thats because the project I check out just before has no
**/requirements.txt
or**/pyproject.toml
file.And the reason it has no such file is that the
actions/checkout
andsetup-python
steps are located in a reused workflow.Action version:
[email protected]
Platform:
Runner type:
Tools version:
Any version of Python.
Repro steps:
Here is the source code of my reused workflow: https://github.com/kdeldycke/workflows/blob/f50130aabec1fe713a548e3296f723732c79a178/.github/workflows/lint.yaml#L26-L35
And here is the result of this invokation: https://github.com/kdeldycke/awesome-iam/actions/runs/7592900227/job/20682781487#step:3:13
Expected behavior:
I expect
setup-python
not to fail in the absence of a**/requirements.txt
or**/pyproject.toml
file.Actual behavior:
The step fails with the following message:
The text was updated successfully, but these errors were encountered: