Fix GitHub Caching action for Windows#1157
Merged
aomarks merged 5 commits intosetup-github-actions-cachingfrom Aug 13, 2024
Merged
Fix GitHub Caching action for Windows#1157aomarks merged 5 commits intosetup-github-actions-cachingfrom
aomarks merged 5 commits intosetup-github-actions-cachingfrom
Conversation
rictic
approved these changes
Aug 13, 2024
main.js
Outdated
| console.log(`[main] Custodian server ready`); | ||
| process.exit(0); | ||
| } | ||
| if (Date.now() - start > timeoutSecs * 1000) { |
Member
There was a problem hiding this comment.
Mild optional thing for the future, it's often a bit more elegant to do:
const timedOutTime = Date.now() + (timeoutSecs * 1000);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Windows support for GitHub Actions Caching, which has been broken since the security improvement in #1146. (This only affected users who had upgraded to
v2of the action, and the failure was not fatal, it just disabled caching).The problem was that under Windows,
{detached: true}is not sufficient for keeping the server alive after the parent shell exits. The parent shell will exit as soon as the main launching script is done, because the action is invoked through a GitHub Actionsuses:clause (as opposed torun:where we would be sharing our parent shell with subsequent steps).We now use
startso that the server is not killed when our parent shell exits: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start.Also listens only on
localhostinstead of all hosts (shouldn't matter because we should have strong network isolation for free through the GitHub Actions container, but seems wise, and good in case this code runs in some other context for some reason).Also adds a
CHANGELOG.mdfile.