@intentius/chant-lexicon-forgejo 0.124.29 → 0.124.31

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "1bfe62bac8d38c3eb6ab0b5d881358085645e9e8a459447b9d8c7cc7f8e1a8cb",
4
+ "manifest.json": "ab46d63a952c24ff719d4370ff7188c76232041fdadcb31af27c9be433197c05",
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": "f28d7fb69fb1cfd992496ef41fda0ea5ccd54a29b84ea1c501a44f6a3992c4d5"
11
11
  },
12
- "composite": "645a9fa1b39e472afe38437f35ee54e2e3fb67ca6b00fec854a94fc583de8991"
12
+ "composite": "baad2eae2dde1936145d5f3778f78a952accaddac9e956d1211a1125f955e75a"
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgejo",
3
- "version": "0.124.29",
3
+ "version": "0.124.31",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Forgejo",
6
6
  "intrinsics": [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-forgejo",
3
- "version": "0.124.29",
3
+ "version": "0.124.31",
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.124.29",
58
- "@intentius/chant-lexicon-github": "^0.124.29"
57
+ "@intentius/chant": "^0.124.31",
58
+ "@intentius/chant-lexicon-github": "^0.124.31"
59
59
  },
60
60
  "scripts": {
61
61
  "generate": "tsx src/codegen/generate-cli.ts",
@@ -0,0 +1,80 @@
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
19
+ steps:
20
+ - uses: https://code.forgejo.org/actions/checkout@v7
21
+ with:
22
+ fetch-depth: 0
23
+ - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
24
+ - name: Build the templates
25
+ run: chant build --env prod
26
+ - name: Lint the project
27
+ run: chant lint
28
+ - name: Plan the members this pull request reaches
29
+ env:
30
+ BASE_SHA: '${{ github.event.pull_request.base.sha }}'
31
+ PR_NUMBER: '${{ github.event.pull_request.number }}'
32
+ GITHUB_TOKEN: '${{ github.token }}'
33
+ run: chant components pr-plan --base "$BASE_SHA" --pr "$PR_NUMBER" --env prod --gate pr-apply --output .chant/pr --forge forgejo
34
+ - name: Keep the plan report
35
+ if: always()
36
+ uses: https://code.forgejo.org/actions/upload-artifact@v3
37
+ with:
38
+ name: chant-pr-plan
39
+ path: .chant/pr
40
+ if-no-files-found: ignore
41
+ apply:
42
+ if: github.event_name == 'push'
43
+ runs-on: docker
44
+ container: node:22
45
+ concurrency:
46
+ group: chant-apply-prod
47
+ cancel-in-progress: false
48
+ steps:
49
+ - uses: https://code.forgejo.org/actions/checkout@v7
50
+ with:
51
+ fetch-depth: 0
52
+ - run: command -v tofu >/dev/null 2>&1 || (curl -fsSL https://get.opentofu.org/install-opentofu.sh -o /tmp/install-opentofu.sh && sh /tmp/install-opentofu.sh --install-method standalone)
53
+ - name: Build the templates
54
+ run: chant build --env prod
55
+ - name: Lint the project
56
+ run: chant lint
57
+ - name: Restore the record of an earlier attempt at this commit
58
+ uses: https://code.forgejo.org/actions/cache/restore@v4
59
+ with:
60
+ path: .chant/pr-resume/pr-apply.json
61
+ key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
62
+ restore-keys: chant-apply-prod-${{ github.sha }}-
63
+ - name: Apply the plan a reviewer approved
64
+ env:
65
+ BASE_SHA: '${{ github.event.before }}'
66
+ GITHUB_TOKEN: '${{ github.token }}'
67
+ run: chant components pr-apply --base "$BASE_SHA" --env prod --gate pr-apply --output .chant/pr --forge forgejo --require-review --resume .chant/pr-resume/pr-apply.json
68
+ - name: Keep the record for a re-run
69
+ if: always()
70
+ uses: https://code.forgejo.org/actions/cache/save@v4
71
+ with:
72
+ path: .chant/pr-resume/pr-apply.json
73
+ key: chant-apply-prod-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
74
+ - name: Keep the apply report
75
+ if: always()
76
+ uses: https://code.forgejo.org/actions/upload-artifact@v3
77
+ with:
78
+ name: chant-pr-apply
79
+ path: .chant/pr
80
+ if-no-files-found: ignore
@@ -11,6 +11,7 @@ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "nod
11
11
  import { tmpdir } from "node:os";
12
12
  import { join } from "node:path";
13
13
  import { describe, expect, test } from "vitest";
14
+ import { parseYAML } from "@intentius/chant/yaml";
14
15
  import type { DriverComponent } from "@intentius/chant/components/driver";
15
16
  import { generateGithubPipeline } from "@intentius/chant-lexicon-github/components/generate-pipeline";
16
17
  import { generateForgejoPipeline } from "./generate-pipeline";
@@ -84,3 +85,34 @@ describe("the Forgejo pull-request workflow", () => {
84
85
  }
85
86
  });
86
87
  });
88
+
89
+ describe("the forgejo pull-request pipeline with build (#4088)", () => {
90
+ const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { build: true } });
91
+ const doc = parseYAML(result.yaml) as Record<string, any>;
92
+ const golden = join(import.meta.dirname, "__fixtures__", "pr-loop-build.forgejo.golden.yml");
93
+
94
+ test("matches its golden", () => {
95
+ if (process.env.UPDATE_GOLDEN) writeFileSync(golden, result.yaml);
96
+ expect(result.yaml).toBe(readFileSync(golden, "utf-8"));
97
+ });
98
+
99
+ test("builds, then lints, before pr-plan and pr-apply", () => {
100
+ for (const job of ["plan", "apply"]) {
101
+ const runs = doc.jobs[job].steps.map((s: { run?: string }) => s.run ?? "").filter(Boolean);
102
+ const i = runs.findIndex((r: string) => r.startsWith("chant components pr-"));
103
+ expect(runs.slice(i - 2, i)).toEqual(["chant build --env prod", "chant lint"]);
104
+ }
105
+ });
106
+
107
+ test("buildCommand replaces the build line and turns the option on", () => {
108
+ const yaml = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { buildCommand: "npm run build" } }).yaml;
109
+ expect(yaml).toContain("npm run build");
110
+ expect(yaml).not.toContain("chant build --env");
111
+ expect(yaml).toContain("chant lint");
112
+ });
113
+
114
+ test("the default output carries neither line", () => {
115
+ const plain = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: {} }).yaml;
116
+ expect(plain).not.toContain("chant lint");
117
+ });
118
+ });