actionspack 0.1.0 → 0.1.2
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 +27 -0
- package/dist/cli.mjs +1 -1
- package/dist/{commands-V9OOSAvq.mjs → commands-jdSon0td.mjs} +15 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
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,5 +1,5 @@
|
|
|
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-
|
|
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-jdSon0td.mjs";
|
|
3
3
|
import { styleText } from "node:util";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { cac } from "cac";
|
|
@@ -158,7 +158,7 @@ function canEvaluateExpression(expr, values) {
|
|
|
158
158
|
if (expr instanceof ContextAccess) return Object.hasOwn(values, expr.name.lexeme);
|
|
159
159
|
if (expr instanceof FunctionCall) return expr.args.every((arg) => canEvaluateExpression(arg, values));
|
|
160
160
|
if (expr instanceof Grouping) return canEvaluateExpression(expr.group, values);
|
|
161
|
-
if (expr instanceof IndexAccess) return
|
|
161
|
+
if (expr instanceof IndexAccess) return hasStaticValueForIndexAccess(expr, values) || canEvaluateExpression(expr.expr, values) && canEvaluateExpression(expr.index, values);
|
|
162
162
|
if (expr instanceof Literal) return true;
|
|
163
163
|
if (expr instanceof Logical) return expr.args.every((arg) => canEvaluateExpression(arg, values));
|
|
164
164
|
if (expr instanceof Star) return false;
|
|
@@ -217,7 +217,18 @@ function dataLiteral(value) {
|
|
|
217
217
|
return valueLiteral(dataValue(value));
|
|
218
218
|
}
|
|
219
219
|
function replacementForIndexAccess(expr, values) {
|
|
220
|
-
|
|
220
|
+
if (!hasValueForIndexAccess(expr, values)) return;
|
|
221
|
+
const value = valueForIndexAccess(expr, values);
|
|
222
|
+
if (typeof value === "string") {
|
|
223
|
+
const body = expressionBody(value.trim());
|
|
224
|
+
if (body !== void 0) return `(${body})`;
|
|
225
|
+
}
|
|
226
|
+
return valueLiteral(value);
|
|
227
|
+
}
|
|
228
|
+
function hasStaticValueForIndexAccess(expr, values) {
|
|
229
|
+
if (!hasValueForIndexAccess(expr, values)) return false;
|
|
230
|
+
const value = valueForIndexAccess(expr, values);
|
|
231
|
+
return typeof value !== "string" || expressionBody(value.trim()) === void 0;
|
|
221
232
|
}
|
|
222
233
|
function printIndexAccess(expr, values) {
|
|
223
234
|
const target = printExpression(expr.expr, values);
|
|
@@ -898,6 +909,8 @@ function substituteString(value, values) {
|
|
|
898
909
|
const expr = parseExpression(expression);
|
|
899
910
|
const replacement = directReplacement(expr, values);
|
|
900
911
|
if (replacement !== void 0) return replacement;
|
|
912
|
+
const evaluated = staticExpression(expr, values);
|
|
913
|
+
if (evaluated) return evaluated.value;
|
|
901
914
|
const simplified = printExpression(expr, values);
|
|
902
915
|
const staticValue = staticExpression(parseExpression(simplified), values);
|
|
903
916
|
return staticValue ? staticValue.value : `\${{ ${simplified} }}`;
|
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-
|
|
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-jdSon0td.mjs";
|
|
2
2
|
export { assertNoRemoteUses, collectStepDependencies, collectWorkflowDependencies, diff, diffLockfiles, pack, packWorkflow, scan, tree, update, verify, why };
|