actionspack 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,6 +13,23 @@ It currently supports inlining composite actions and safely transformable
13
13
  reusable workflows. JavaScript and Docker actions are pinned as external
14
14
  dependencies instead of being bundled.
15
15
 
16
+ ## Why actionspack?
17
+
18
+ GitHub Actions workflows often depend on reusable workflows and actions from
19
+ other repositories. You may want to author those dependencies with convenient
20
+ floating refs like `@main` in `.github/workflows/src/`, but generated workflows
21
+ should be reproducible and reviewable.
22
+
23
+ `actionspack` gives workflows a lockfile mechanism similar to `pnpm`. It locks
24
+ remote workflows and actions in `.github/workflow.lock.yml`, inlines everything
25
+ that can be transformed safely into the local repository, and pins anything that
26
+ cannot be inlined to a fixed SHA.
27
+
28
+ To update workflow and action dependencies, run `actionspack update`
29
+ periodically. The updated lockfile and generated workflows are normal repository
30
+ files, so `git diff` shows exactly which dependencies changed and what generated
31
+ workflow output changed.
32
+
16
33
  ## Install
17
34
 
18
35
  ```bash
@@ -49,6 +66,16 @@ npx actionspack
49
66
  Generated workflows are safe to commit. Existing lockfile SHAs are reused until
50
67
  you explicitly run `actionspack update`.
51
68
 
69
+ When you want to refresh workflow/action dependencies:
70
+
71
+ ```bash
72
+ npx actionspack update
73
+ git diff
74
+ ```
75
+
76
+ Review the dependency SHA changes in `.github/workflow.lock.yml` and the
77
+ resulting generated workflow changes before committing.
78
+
52
79
  ## Commands
53
80
 
54
81
  ```bash
package/dist/cli.mjs CHANGED
@@ -1,20 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { a as why, f as scan, i as update, l as verify, r as tree, s as pack, t as diff } from "./commands-CPJczWTq.mjs";
2
+ import { a as why, f as scan, i as update, l as verify, r as tree, s as pack, t as diff } from "./commands-4KKgssQI.mjs";
3
3
  import { styleText } from "node:util";
4
4
  import process from "node:process";
5
5
  import { cac } from "cac";
6
+ //#region package.json
7
+ var name = "actionspack";
8
+ var version = "0.1.3";
6
9
  //#endregion
7
10
  //#region src/cli.ts
8
- const cli = cac("actionspack");
11
+ const cli = cac(name);
9
12
  async function main() {
10
- cli.command("", "Pack workflows").option("--entry <source:output>", "Use an explicit source/output workflow mapping").option("--external <selector>", "Pin a workflow or action without bundling it").action(async (flags) => {
11
- await pack({
12
- ...normalizeConfigFlags(flags),
13
- stderr: process.stderr,
14
- stdout: process.stdout
15
- });
16
- });
17
- cli.command("pack", "Pack workflows").option("--entry <source:output>", "Use an explicit source/output workflow mapping").option("--external <selector>", "Pin a workflow or action without bundling it").action(async (flags) => {
13
+ cli.command("", "Pack workflows").alias("pack").option("--entry <source:output>", "Use an explicit source/output workflow mapping").option("--external <selector>", "Pin a workflow or action without bundling it").action(async (flags) => {
18
14
  await pack({
19
15
  ...normalizeConfigFlags(flags),
20
16
  stderr: process.stderr,
@@ -53,7 +49,7 @@ async function main() {
53
49
  cli.command("verify", "Verify lockfile and packed workflows").action(async () => {
54
50
  await verify();
55
51
  });
56
- cli.help();
52
+ cli.version(version).help();
57
53
  cli.parse(process.argv, { run: false });
58
54
  await cli.runMatchedCommand();
59
55
  }
@@ -909,6 +909,8 @@ function substituteString(value, values) {
909
909
  const expr = parseExpression(expression);
910
910
  const replacement = directReplacement(expr, values);
911
911
  if (replacement !== void 0) return replacement;
912
+ const evaluated = staticExpression(expr, values);
913
+ if (evaluated) return evaluated.value;
912
914
  const simplified = printExpression(expr, values);
913
915
  const staticValue = staticExpression(parseExpression(simplified), values);
914
916
  return staticValue ? staticValue.value : `\${{ ${simplified} }}`;
@@ -1261,11 +1263,15 @@ function appendDependencyTree(lines, lockfile, dependencies, prefix) {
1261
1263
  dependencies.forEach((dependency, index) => {
1262
1264
  const last = index === dependencies.length - 1;
1263
1265
  const item = lockfile.packages[dependency.package];
1264
- const label = item ? `${item.owner}/${item.repo}${item.path === "." ? "" : `/${item.path}`}@${item.requested} (${item.resolved})` : `${dependency.package}@${dependency.requested}`;
1266
+ const label = item ? formatPackageTreeLabel(item) : `${dependency.package}@${dependency.requested}`;
1265
1267
  lines.push(`${prefix}${last ? "└─" : "├─"} ${label}`);
1266
1268
  if (item) appendDependencyTree(lines, lockfile, item.dependencies, `${prefix}${last ? " " : "│ "}`);
1267
1269
  });
1268
1270
  }
1271
+ function formatPackageTreeLabel(item) {
1272
+ const requested = `${`${item.owner}/${item.repo}${item.path === "." ? "" : `/${item.path}`}`}@${item.requested}`;
1273
+ return item.requested === item.resolved ? requested : `${requested} (${item.resolved})`;
1274
+ }
1269
1275
  function collectWhyPaths(lockfile, dependency, matches, current, paths) {
1270
1276
  const item = lockfile.packages[dependency.package];
1271
1277
  const label = item ? `${item.owner}/${item.repo}${item.path === "." ? "" : `/${item.path}`}` : dependency.package;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as why, c as packWorkflow, d as collectWorkflowDependencies, f as scan, i as update, l as verify, n as diffLockfiles, o as assertNoRemoteUses, r as tree, s as pack, t as diff, u as collectStepDependencies } from "./commands-CPJczWTq.mjs";
1
+ import { a as why, c as packWorkflow, d as collectWorkflowDependencies, f as scan, i as update, l as verify, n as diffLockfiles, o as assertNoRemoteUses, r as tree, s as pack, t as diff, u as collectStepDependencies } from "./commands-4KKgssQI.mjs";
2
2
  export { assertNoRemoteUses, collectStepDependencies, collectWorkflowDependencies, diff, diffLockfiles, pack, packWorkflow, scan, tree, update, verify, why };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "actionspack",
3
3
  "type": "module",
4
- "version": "0.1.1",
4
+ "version": "0.1.3",
5
5
  "description": "Lockfile-first GitHub Actions workflow packer",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",