Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 4 additions & 1 deletion .github/workflows/licensed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ jobs:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
- run: npm ci
- name: Install licensed
run: |
Expand Down
63 changes: 29 additions & 34 deletions fetch.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,46 @@
const core = require("@actions/core");
const { execSync } = require("child_process");
const cache = require("@actions/cache");
const { parseBooleanInput, buildBaseConfig } = require("./utils");

async function fetchCache() {
try {
const cleanUpCache = parseBooleanInput(core.getInput("clean"));
if (cleanUpCache) return;

import * as core from "@actions/core";
import { execSync } from "node:child_process";
import * as cache from "@actions/cache";
import { buildBaseConfig } from "./utils.js";
Comment on lines +1 to +4
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

execSync is still imported but the timestamp logic was switched to Date.now(), so execSync is no longer used in this file. Remove the node:child_process import to avoid dead code and keep the module dependency surface minimal.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The execSync import is still needed — it's used on lines 35-36 for the sed commands that skip toolchain building. The reviewer's suggestion was incorrect; removing the import would break the action when cacheToolchain && skipBuildingToolchain is true.


try {
const cleanUpCache = core.getBooleanInput("clean");
if (!cleanUpCache) {
const { keyString: baseKey, paths, cacheToolchain, cacheCcache } = buildBaseConfig();
const skipBuildingToolchain = parseBooleanInput(core.getInput("skip"), true);
const skipBuildingToolchain = core.getBooleanInput("skip");
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

This changes the default/accepted values behavior for skip: previously parseBooleanInput(core.getInput(\"skip\"), true) implies a default of true (and possibly more permissive parsing like 1/0, depending on the removed helper). core.getBooleanInput(\"skip\") returns false when the input is absent and throws on invalid values, which may inadvertently flip behavior or break existing users. To preserve prior semantics, either set default: 'true' for skip in action.yml (preferred) or explicitly implement a true fallback when the input is unset while keeping strict validation consistent with your intended UX.

Suggested change
const skipBuildingToolchain = core.getBooleanInput("skip");
const skipInput = core.getInput("skip");
let skipBuildingToolchain: boolean;
if (skipInput === "") {
// Preserve previous semantics: default to true when input is unset
skipBuildingToolchain = true;
} else if (/^(true|1)$/i.test(skipInput)) {
skipBuildingToolchain = true;
} else if (/^(false|0)$/i.test(skipInput)) {
skipBuildingToolchain = false;
} else {
throw new Error(
"Invalid value for 'skip'. Expected one of: 'true', 'false', '1', '0', or empty (defaults to true)."
);
}

Copilot uses AI. Check for mistakes.

let keyString = baseKey;
const restoreKeys = [];

if (cacheCcache) {
const timestamp = execSync("date +%s").toString().trim();
const timestamp = Math.floor(Date.now() / 1000).toString();
restoreKeys.unshift(keyString);
keyString += `-${timestamp}`;
paths.push(".ccache");
}

if (paths.length === 0) {
core.debug("No paths configured for caching, skipping");
return;
}
if (paths.length > 0) {
core.debug(`Cache key: ${keyString}`);
core.debug(`Cache restore keys: ${restoreKeys.join(", ")}`);
core.debug(`Cache paths: ${paths.join(", ")}`);

core.debug(`Cache key: ${keyString}`);
core.debug(`Cache restore keys: ${restoreKeys.join(", ")}`);
core.debug(`Cache paths: ${paths.join(", ")}`);
const cacheFetchingResult = await cache.restoreCache(paths, keyString, restoreKeys);

const cacheFetchingResult = await cache.restoreCache(paths, keyString, restoreKeys);
if (cacheFetchingResult) {
core.info(`${cacheFetchingResult} cache fetched!`);
core.setOutput("hit", "1");
core.saveState("CACHE_STATE", "hit");

if (cacheFetchingResult) {
core.info(`${cacheFetchingResult} cache fetched!`);
core.setOutput("hit", "1");
core.saveState("CACHE_STATE", "hit");

if (cacheToolchain && skipBuildingToolchain) {
execSync("sed -i 's/ $(tool.*\\/stamp-compile)//;' Makefile");
execSync("sed -i 's/ $(tool.*\\/stamp-install)//;' Makefile");
core.info("Toolchain building skipped");
if (cacheToolchain && skipBuildingToolchain) {
execSync("sed -i 's/ $(tool.*\\/stamp-compile)//;' Makefile");
execSync("sed -i 's/ $(tool.*\\/stamp-install)//;' Makefile");
core.info("Toolchain building skipped");
}
}
} else {
core.debug("No paths configured for caching, skipping");
}
} catch (error) {
core.setFailed(error.message);
}
}

fetchCache();
} catch (error) {
core.setFailed(error.message);
}
1 change: 0 additions & 1 deletion node_modules/.bin/protoc

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/protoc-gen-dump

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/protoc-gen-ts

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/tsc

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/tsserver

This file was deleted.

1 change: 0 additions & 1 deletion node_modules/.bin/uuid

This file was deleted.

Loading
Loading