@intentius/chant-lexicon-forgejo 0.101.0 → 0.104.0
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/dist/components/generate-pipeline.d.ts.map +1 -1
- package/dist/integrity.json +2 -2
- package/dist/manifest.json +1 -1
- package/package.json +4 -4
- package/src/components/__fixtures__/pr-loop.forgejo.golden.yml +60 -0
- package/src/components/generate-op-pipeline.test.ts +2 -2
- package/src/components/generate-pipeline.test.ts +1 -1
- package/src/components/generate-pipeline.ts +5 -1
- package/src/components/generate-pr-pipeline.test.ts +61 -0
- package/src/mcp/context-tools.test.ts +1 -1
- package/src/serializer.test.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAOjF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,wBAA6B,EACtC,cAAc,GAAE,qBAA0B,GACzC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"generate-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAOjF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,wBAA6B,EACtC,cAAc,GAAE,qBAA0B,GACzC,uBAAuB,CAsBzB"}
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "0ff4ad3e4d215c562d715001533530cdfb1cde428d3bde2cbc147bbf5ae29d89",
|
|
5
5
|
"meta.json": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
|
|
6
6
|
"types/index.d.ts": "66204549b2a864ab5489e3f02c1878e73ab4b3c9d938cfb480b66f71543a43de",
|
|
7
7
|
"rules/delegate-to-github.ts": "1060cda40f4b73d6cca3ba3fa13b80b4886147d4034c88584c2d80c5510dbe5e",
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
"rules/wfj011.ts": "fcb8bf6685d744af20ad804ce929488257995c74b9a3353b2eacae3768d1c83e",
|
|
10
10
|
"skills/chant-forgejo.md": "a1a560429db736c187e0b34cf8dd9efc6ad771afefcbf6f802d160d3d5274257"
|
|
11
11
|
},
|
|
12
|
-
"composite": "
|
|
12
|
+
"composite": "988eb432f002d2f7dfe3a822cf0d8a6377e82a5a89fad9534447953844169331"
|
|
13
13
|
}
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-forgejo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.0",
|
|
4
4
|
"description": "Forgejo / Codeberg / Gitea Actions lexicon for chant — a thin GitHub Actions dialect",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"zod": "^4.3.6",
|
|
57
|
-
"@intentius/chant": "^0.
|
|
58
|
-
"@intentius/chant-lexicon-github": "^0.
|
|
57
|
+
"@intentius/chant": "^0.104.0",
|
|
58
|
+
"@intentius/chant-lexicon-github": "^0.104.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"generate": "tsx src/codegen/generate-cli.ts",
|
|
62
62
|
"bundle": "tsx src/codegen/package-cli.ts",
|
|
63
63
|
"docs": "tsx src/codegen/docs-cli.ts",
|
|
64
64
|
"prepack": "npm run generate && npm run bundle && npm run build",
|
|
65
|
-
"build": "
|
|
65
|
+
"build": "../../scripts/tsc7.sh -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && find dist -type f \\( -name \"*.js\" -o -name \"*.js.map\" \\) -delete"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: chant-pr-prod
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
CHANT_ENV: prod
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
plan:
|
|
16
|
+
if: github.event_name == 'pull_request'
|
|
17
|
+
runs-on: docker
|
|
18
|
+
container: node:22-slim
|
|
19
|
+
steps:
|
|
20
|
+
- uses: https://code.forgejo.org/actions/checkout@v7
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
- name: Plan the members this pull request reaches
|
|
24
|
+
env:
|
|
25
|
+
BASE_SHA: '${{ github.event.pull_request.base.sha }}'
|
|
26
|
+
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
|
27
|
+
GITHUB_TOKEN: '${{ github.token }}'
|
|
28
|
+
run: chant components pr-plan --base "$BASE_SHA" --pr "$PR_NUMBER" --env prod --gate pr-apply --output .chant/pr --forge forgejo
|
|
29
|
+
- name: Keep the plan report
|
|
30
|
+
if: always()
|
|
31
|
+
uses: https://code.forgejo.org/actions/upload-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
name: chant-pr-plan
|
|
34
|
+
path: .chant/pr
|
|
35
|
+
if-no-files-found: ignore
|
|
36
|
+
include-hidden-files: true
|
|
37
|
+
apply:
|
|
38
|
+
if: github.event_name == 'push'
|
|
39
|
+
runs-on: docker
|
|
40
|
+
container: node:22-slim
|
|
41
|
+
concurrency:
|
|
42
|
+
group: chant-apply-prod
|
|
43
|
+
cancel-in-progress: false
|
|
44
|
+
steps:
|
|
45
|
+
- uses: https://code.forgejo.org/actions/checkout@v7
|
|
46
|
+
with:
|
|
47
|
+
fetch-depth: 0
|
|
48
|
+
- name: Apply the plan a reviewer approved
|
|
49
|
+
env:
|
|
50
|
+
BASE_SHA: '${{ github.event.before }}'
|
|
51
|
+
GITHUB_TOKEN: '${{ github.token }}'
|
|
52
|
+
run: chant components pr-apply --base "$BASE_SHA" --env prod --gate pr-apply --output .chant/pr --forge forgejo --require-review
|
|
53
|
+
- name: Keep the apply report
|
|
54
|
+
if: always()
|
|
55
|
+
uses: https://code.forgejo.org/actions/upload-artifact@v4
|
|
56
|
+
with:
|
|
57
|
+
name: chant-pr-apply
|
|
58
|
+
path: .chant/pr
|
|
59
|
+
if-no-files-found: ignore
|
|
60
|
+
include-hidden-files: true
|
|
@@ -202,7 +202,7 @@ describe("generateForgejoOpPipeline: setup steps and additive permissions (#2242
|
|
|
202
202
|
const steps = doc.jobs!["app-apply"].steps;
|
|
203
203
|
// The checkout is rewritten to the Forgejo mirror; an action with no
|
|
204
204
|
// mapping in ../actions.ts passes through verbatim.
|
|
205
|
-
expect(steps[0].uses).toContain("actions/checkout@
|
|
205
|
+
expect(steps[0].uses).toContain("actions/checkout@v7");
|
|
206
206
|
expect(steps[1].uses).toBe("aws-actions/configure-aws-credentials@v6");
|
|
207
207
|
expect((steps[1] as { with?: Record<string, string> }).with).toEqual({
|
|
208
208
|
"role-to-assume": "${{ vars.AWS_ROLE_ARN }}",
|
|
@@ -320,7 +320,7 @@ describe("generateForgejoOpPipeline: a dropped deployment environment (#2257)",
|
|
|
320
320
|
" runs-on: docker",
|
|
321
321
|
" container: node:22-slim",
|
|
322
322
|
" steps:",
|
|
323
|
-
" - uses: https://code.forgejo.org/actions/checkout@
|
|
323
|
+
" - uses: https://code.forgejo.org/actions/checkout@v7",
|
|
324
324
|
" - run: chant run actions-audit",
|
|
325
325
|
" env:",
|
|
326
326
|
" GITHUB_TOKEN: '${{ github.token }}'",
|
|
@@ -110,7 +110,7 @@ describe("generateForgejoPipeline: dialect applied", () => {
|
|
|
110
110
|
expect(ref).toContain("code.forgejo.org/actions/");
|
|
111
111
|
}
|
|
112
112
|
// checkout is present and mirrored.
|
|
113
|
-
expect(all.some((r) => r === "https://code.forgejo.org/actions/checkout@
|
|
113
|
+
expect(all.some((r) => r === "https://code.forgejo.org/actions/checkout@v7")).toBe(true);
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
|
|
@@ -53,7 +53,11 @@ export function generateForgejoPipeline(
|
|
|
53
53
|
options: ComponentPipelineOptions = {},
|
|
54
54
|
dialectOptions: ForgejoDialectOptions = {},
|
|
55
55
|
): ComponentPipelineResult {
|
|
56
|
-
|
|
56
|
+
// The pull-request loop (#3183) talks to the forge, so its commands name Forgejo.
|
|
57
|
+
const doc = buildGithubPipelineDoc(
|
|
58
|
+
components,
|
|
59
|
+
options.prLoop ? { ...options, prLoop: { ...options.prLoop, forge: "forgejo" } } : options,
|
|
60
|
+
);
|
|
57
61
|
|
|
58
62
|
const forgejoDoc: GithubPipelineDoc = {
|
|
59
63
|
// The environment identity (#2046) is dialect-neutral: name, environment,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated pull-request workflow for Forgejo Actions (#3183): github's
|
|
3
|
+
* workflow with the Forgejo dialect applied and its commands talking to
|
|
4
|
+
* Forgejo. The whole file has a golden, and actionlint checks it when it is
|
|
5
|
+
* installed, less the two things it cannot know about Forgejo: the runner
|
|
6
|
+
* label and actions referenced by URL.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { execFileSync } from "node:child_process";
|
|
10
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { describe, expect, test } from "vitest";
|
|
14
|
+
import type { DriverComponent } from "@intentius/chant/components/driver";
|
|
15
|
+
import { generateForgejoPipeline } from "./generate-pipeline";
|
|
16
|
+
|
|
17
|
+
const ESTATE: DriverComponent[] = [
|
|
18
|
+
{ name: "net", dependsOn: [], deploy: [{ phase: "Apply", steps: [{ kind: "terraform-apply", root: "net" }] }] },
|
|
19
|
+
{ name: "app", dependsOn: ["net"], deploy: [{ phase: "Apply", steps: [{ kind: "terraform-apply", root: "app" }] }] },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const GOLDEN = join(import.meta.dirname, "__fixtures__", "pr-loop.forgejo.golden.yml");
|
|
23
|
+
|
|
24
|
+
function hasActionlint(): boolean {
|
|
25
|
+
try {
|
|
26
|
+
execFileSync("actionlint", ["-version"], { stdio: "ignore" });
|
|
27
|
+
return true;
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
describe("the Forgejo pull-request workflow", () => {
|
|
34
|
+
const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: {} });
|
|
35
|
+
|
|
36
|
+
test("matches its golden", () => {
|
|
37
|
+
if (process.env.UPDATE_GOLDEN) writeFileSync(GOLDEN, result.yaml);
|
|
38
|
+
expect(result.yaml).toBe(readFileSync(GOLDEN, "utf-8"));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("its commands talk to Forgejo, on Forgejo's runner, with no permissions block", () => {
|
|
42
|
+
expect(result.yaml).toContain("--forge forgejo");
|
|
43
|
+
expect(result.yaml).not.toContain("--forge github");
|
|
44
|
+
expect(result.yaml).toContain("runs-on: docker");
|
|
45
|
+
expect(result.yaml).not.toMatch(/^\s+permissions:/m);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test.skipIf(!hasActionlint())("passes actionlint, less the runner label and actions by URL", () => {
|
|
49
|
+
const dir = mkdtempSync(join(tmpdir(), "chant-actionlint-"));
|
|
50
|
+
try {
|
|
51
|
+
mkdirSync(join(dir, ".github", "workflows"), { recursive: true });
|
|
52
|
+
writeFileSync(join(dir, ".github", "workflows", "chant-pr.yml"), result.yaml);
|
|
53
|
+
const ignore = ['label "docker" is unknown', "invalid format because owner and repo and ref should not be empty"];
|
|
54
|
+
expect(() =>
|
|
55
|
+
execFileSync("actionlint", [...ignore.flatMap((p) => ["-ignore", p]), ".github/workflows/chant-pr.yml"], { cwd: dir, encoding: "utf8" }),
|
|
56
|
+
).not.toThrow();
|
|
57
|
+
} finally {
|
|
58
|
+
rmSync(dir, { recursive: true, force: true });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -80,7 +80,7 @@ describe("forgejo context tools", () => {
|
|
|
80
80
|
test("forgejo:references reports the rewritten + unmapped refs", async () => {
|
|
81
81
|
const refs = (await tool("forgejo:references").handler({ path: join(dir, "src") })) as Array<{ source: string }>;
|
|
82
82
|
const sources = refs.map((r) => r.source);
|
|
83
|
-
expect(sources).toContain("https://code.forgejo.org/actions/checkout@
|
|
83
|
+
expect(sources).toContain("https://code.forgejo.org/actions/checkout@v7");
|
|
84
84
|
expect(sources).toContain("some-org/custom-action@v1");
|
|
85
85
|
});
|
|
86
86
|
|
package/src/serializer.test.ts
CHANGED
|
@@ -88,15 +88,15 @@ describe("forgejoSerializer — uses: action resolution", () => {
|
|
|
88
88
|
const { primary } = asResult(
|
|
89
89
|
forgejoSerializer.serialize(withSteps(Checkout({}).step, SetupNode({ nodeVersion: "22" }).step)),
|
|
90
90
|
);
|
|
91
|
-
expect(primary).toContain(`uses: ${DEFAULT_ACTIONS_ROOT}/actions/checkout@
|
|
92
|
-
expect(primary).toContain(`uses: ${DEFAULT_ACTIONS_ROOT}/actions/setup-node@
|
|
91
|
+
expect(primary).toContain(`uses: ${DEFAULT_ACTIONS_ROOT}/actions/checkout@v7`);
|
|
92
|
+
expect(primary).toContain(`uses: ${DEFAULT_ACTIONS_ROOT}/actions/setup-node@v7`);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
test("forgejo.actionsRoot override changes the rewritten base", () => {
|
|
96
96
|
const out = forgejoSerializer.serialize(withSteps(Checkout({}).step), undefined, {
|
|
97
97
|
config: { forgejo: { actionsRoot: "https://codeberg.org" } },
|
|
98
98
|
});
|
|
99
|
-
expect(asResult(out).primary).toContain("uses: https://codeberg.org/actions/checkout@
|
|
99
|
+
expect(asResult(out).primary).toContain("uses: https://codeberg.org/actions/checkout@v7");
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
test("an unmapped action ref is passed through (WFJ010 reports it post-synth)", () => {
|