Skip to content
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

Support multiple flake directories #109

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Conversation

lucperkins
Copy link
Member

@lucperkins lucperkins commented May 23, 2024

We like the idea behind #98 but unfortunately we switched this Action to use JS instead of Bash, which means that implementing that would be a non-trivial amount of work for @DavHau so I've decided to go ahead and implement it on my own (given that I know our internal libs well).

@lucperkins
Copy link
Member Author

@DavHau If you could give this a try in one of your repos, that would be great!

- uses: DeterminateSystems/update-flake-lock@multiple-flake-dirs-ts

@DavHau
Copy link

DavHau commented May 28, 2024

Thanks for this. Will test it tomorrow

@lucperkins lucperkins marked this pull request as draft June 3, 2024 20:45
@lucperkins
Copy link
Member Author

lucperkins commented Jun 3, 2024

I've tested this out in an external repo: https://github.com/lucperkins/update-flake-lock-multiple-dirs

This run successfully created this PR (with sub-dirs subflake1 and subflake2).

There were two unsuccessful runs of the same workflow but that was solely related to improper permissions on the test repo. Changing the permissions resolved the issue.

@lucperkins lucperkins marked this pull request as ready for review June 3, 2024 20:56
Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to your test run, functionality seems to work just fine, but I'm a bit worried about UX.

  • The PR body only lists one of the updated flake.locks.
    • I'd expect it to either list all of them, or none of them.
  • The commit messages are all just flake.lock: Update, but flake.lock is only updated once -- the others that are updated are subflake1/flake.lock and subflake2/flake.lock. However, if I manually put a flake.nix and flake.lock in some subdir in a local repo of mine and run nix flake update --commit-lock-file, it correctly commits it as subdir/flake.lock: Update

.github/workflows/update.yml Outdated Show resolved Hide resolved
@lucperkins
Copy link
Member Author

lucperkins commented Jun 3, 2024

@cole-h The root flake.lock is only updated once because I added it after the two sub-dirs. As for the PR body, we are a bit constrained here by Actions' inputs (in this case the pr-body input). Those can't be dynamic and the best we can do is update the default value.

Update: okay, I see now that we have some flexibility with the templating so I'll update the pr-body default to be more descriptive.

@lucperkins lucperkins marked this pull request as draft June 3, 2024 21:22
@cole-h
Copy link
Member

cole-h commented Jun 3, 2024

Yes, I know the root flake.lock is only updated once. However, if you look at your PR, the commit messages all say flake.lock: Update:

image

Whereas using nix flake update --commit-lock-file in a subdirectory will give you path/to/the/flake.lock: Update as the commit message.

This doesn't strike me as good UX, not being able to distinguish between which commit updated which flake.lock....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants