-
Notifications
You must be signed in to change notification settings - Fork 473
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
automatically perform uv lock
#4142
Conversation
Looks like this could help us. https://github.com/pre-commit/action |
Thanks! I've seen that before, but running all other pre-commit hooks with GitHub Actions might not be a good idea. Maybe it would be better to manually implement |
7648918
to
ec61792
Compare
I had a go in #4165, think that seems like a reasonable solution? |
4a8f95b
to
5a965c2
Compare
Accidentally closed it. It should be fine now. |
Oh man, this is way more complicated that I figured. I'll put my thoughts here, but first I should double check I understand what this is doing:
The first part feels fine, but I'm not so sure about the second. If something has changed in the base branch, that means that the lock file committed in the PR might be out of sync from the PR itself (but that everything would be fine once it got merged.) I think that just running the lock against the HEAD of the PR might be simpler and more desirable. It might end up causing a merge conflict if there were also dep changes in the base branch, but I don't think that's really a problem. (Is that the worst potential outcome?) Would something simpler without all the scripting (like I was thinking in #4165) work if we just wanted to run on the HEAD of the PR? Sorry I waited for you to do all this work to ask these questions, I didn't fully understand your plan until seeing this. |
Your understanding of this PR is correct.
I had previously considered whether
The following lines can be replaced with - name: Install uv
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5
with:
enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}
version: ${{ env.UV_VERSION }}
- id: push
run: |
if [[ ${{github.event_name}} == "push" ]]
then
uv lock
else
uv lock --directory merge
mv merge/uv.lock uv.lock
fi However, in order to ensure that the - uses: tox-dev/action-pre-commit-uv@v1
with:
extra_args: uv-lock The only lines of code that can be replaced with if ! git diff --exit-code; then
git config user.email github-actions[bot]@users.noreply.github.com
git config user.name github-actions[bot]
git add uv.lock
git commit -m "Autofix: update uv.lock"
git push
fi These are just my thoughts. If you firmly hold a different opinion, I am willing to make changes. |
Okay, you've convinced me, let's go for it. It looks like we might be able to let pre-commit.ci handle this again soon, there are rumblings that uv lock will no longer need the build backend with a few more changes. |
Currently, Github Actions only checks the consistency between
uv.lock
andpyproject.toml
.This PR automatically performs
uv lock
, so even if you forget to do it, it won't matter.