Skip to content

aptfile support#176

Open
mac-anysphere wants to merge 25 commits intoawalsh128:masterfrom
anysphere:mac/aptfile
Open

aptfile support#176
mac-anysphere wants to merge 25 commits intoawalsh128:masterfrom
anysphere:mac/aptfile

Conversation

@mac-anysphere
Copy link

@mac-anysphere mac-anysphere commented Oct 31, 2025

Does 2 main things:

  • Add support for an Aptfile at the root of your repo directory to install packages if specified. See the updated README.md for more details. An Aptfile is very simple, just a list of packages, one per line, to install with Apt
  • Expands the pull request action to actually run the action as a test to verify it still works. Really needed this to test my changes in a GH action context, think this will be useful for all future PRs.

Note

Adds Aptfile-based package sourcing (merge with input), a use_aptfile toggle, makes packages optional, and persists the normalized package list for restore; docs updated with examples.

  • Action inputs (action.yml):
    • Make inputs.packages optional; add inputs.use_aptfile (default true).
    • Pass use_aptfile to pre_cache_action.sh and wire env vars accordingly.
  • Pre-cache script (pre_cache_action.sh):
    • Add Aptfile parsing/merging logic controlled by use_aptfile.
    • Normalize combined packages; improve empty-packages handling messages.
    • Persist normalized packages to ${cache_dir}/packages.txt and quote writes.
    • Include repo list in cache key; minor validation/quoting tweaks.
  • Post-cache script (post_cache_action.sh):
    • Read packages from ${cache_dir}/packages.txt if present; fallback to input.
  • Library (lib.sh):
    • Add parse_aptfile utility to extract packages from Aptfile.
  • Docs (README.md):
    • Document Aptfile support, merging behavior, use_aptfile flag, and examples (Aptfile-only, combined, disabling).

Written by Cursor Bugbot

@mac-anysphere
Copy link
Author

mac-anysphere commented Oct 31, 2025

Ah sorry, meant to do this on our local fork, but it would also be nice to have this in the upstream! This simple format of Aptfile is how Heroku does it supposedly.

@awalsh128
Copy link
Owner

awalsh128 commented Nov 4, 2025

No problem. Always happy to pull in improvements. This is quite extensive though and does make some behavior changes, which could be potentially breaking and definitely is in some areas for other users.

Can you provide a description of the features in this change? BTW, I am working on a v2 (dev-v2 branch) but it is broken right now, which is all Go based (logic grew beyond scripting lang features). There is also quite a bit of AI slop I have to curate.

@mac-anysphere mac-anysphere marked this pull request as draft November 4, 2025 02:49
@mac-anysphere
Copy link
Author

The goal was to make it work locally with our infra test case, there were a bunch of edge cases that I had to bash my head through as you can see. I'd wait until I'm done and I'll have something cleaner to review.

@awalsh128
Copy link
Owner

SG. You may want to consider having a runner with a rebuilt image daily for your new and/or updated packages. There are GitHub actions that will do this for you and would create less dev hours overall to maintain.

@mac-anysphere
Copy link
Author

we are going that direction but right now I just wanted to do "one quick thing" to make packages reference a single source of truth in our monorepo that took a few more hours than I expected 😂

@mac-anysphere mac-anysphere marked this pull request as ready for review November 4, 2025 03:26
@mac-anysphere
Copy link
Author

ok this should be ready to go, I cleaned it up and removed the unnecessary parts.

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.

2 participants