@intentius/chant-lexicon-forgejo 0.102.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 +3 -3
- package/src/components/__fixtures__/pr-loop.forgejo.golden.yml +60 -0
- package/src/components/generate-pipeline.ts +5 -1
- package/src/components/generate-pr-pipeline.test.ts +61 -0
|
@@ -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,8 +54,8 @@
|
|
|
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",
|
|
@@ -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
|
|
@@ -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
|
+
});
|