-
Notifications
You must be signed in to change notification settings - Fork 14
feat(action.yml): add caching option for Twingate .deb packages to speed up installation process #56
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
base: main
Are you sure you want to change the base?
Conversation
…eed up installation process
…ching functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds an optional caching mechanism for Twingate .deb packages on Linux to improve installation speed. The change introduces a new cache input parameter (defaulting to true) that allows users to cache downloaded .deb packages across workflow runs, reducing installation time by approximately 40-50% (from ~22s to ~14s).
Key Changes
- Added a new
cacheinput parameter to enable/disable package caching - Split the Linux installation into three steps: cache retrieval, package download (on cache miss), and installation from cache
- Retained the original installation method as a fallback when caching is disabled
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
action.yml
Outdated
| id: cache-twingate | ||
| with: | ||
| path: /tmp/twingate-cache | ||
| key: twingate-deb-${{ runner.os }}-${{ runner.arch }} |
Copilot
AI
Dec 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache key does not include the package version, which means that when a new version of the Twingate package is released, the cached old version will continue to be used indefinitely. Consider including a version identifier or timestamp in the cache key, or add a mechanism to invalidate the cache periodically (e.g., using a date-based key component like twingate-deb-${{ runner.os }}-${{ runner.arch }}-v1 where v1 can be manually incremented when needed).
| key: twingate-deb-${{ runner.os }}-${{ runner.arch }} | |
| key: twingate-deb-${{ runner.os }}-${{ runner.arch }}-v1 |
| echo "deb [trusted=yes] https://packages.twingate.com/apt/ /" | sudo tee /etc/apt/sources.list.d/twingate.list | ||
| sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/twingate.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" | ||
| cd /tmp/twingate-cache | ||
| apt-get download twingate |
Copilot
AI
Dec 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'apt-get download' command is missing 'sudo' prefix. Without elevated privileges, this command will fail to download the package. This should be 'sudo apt-get download twingate' to match the pattern used elsewhere in the action.
| apt-get download twingate | |
| sudo apt-get download twingate |
| if: runner.os == 'Linux' && inputs.cache == 'true' | ||
| shell: bash | ||
| run: | | ||
| sudo dpkg -i /tmp/twingate-cache/twingate*.deb || true |
Copilot
AI
Dec 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dpkg installation step uses '|| true' to suppress errors, which could mask legitimate installation failures. If the .deb file doesn't exist or is corrupted, this would silently continue and only rely on 'apt-get install -f' to fix issues. Consider adding explicit error checking to verify the .deb file exists before attempting installation, or at least check that the subsequent apt-get command succeeds.
| sudo dpkg -i /tmp/twingate-cache/twingate*.deb || true | |
| set -e | |
| if ! ls /tmp/twingate-cache/twingate*.deb >/dev/null 2>&1; then | |
| echo "Error: No Twingate .deb package found in /tmp/twingate-cache" >&2 | |
| exit 1 | |
| fi | |
| sudo dpkg -i /tmp/twingate-cache/twingate*.deb |
…ng logic improvement
…aller on Windows to optimize installation process
|
This pull request is stale because it has been open 5 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
Resolves #48
Changes
Cache the .deb file on linux install
Timing before change (see this run):
Timing After change (see this run):