@intentius/chant-lexicon-forgejo 0.124.32 → 0.124.34

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": "7885f3eea1327f2431dd65676726257cf9bd60253edeaa96bc9c1f9e18b2335f",
4
+ "manifest.json": "b9a3a3ed1bc08c5e4bfe6311c531cf2f2f664ad9639c705adfc319a71f8c70b5",
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": "dcc44816420a6008af0661e553d724c0a9242ba2cea6720b9c63bf44bf7ce962"
12
+ "composite": "4c57276189ca07ad4cc41532db77033d92535de9e8648b7eb57f689cabe859c1"
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forgejo",
3
- "version": "0.124.32",
3
+ "version": "0.124.34",
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.32",
3
+ "version": "0.124.34",
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.32",
58
- "@intentius/chant-lexicon-github": "^0.124.32"
57
+ "@intentius/chant": "^0.124.34",
58
+ "@intentius/chant-lexicon-github": "^0.124.34"
59
59
  },
60
60
  "scripts": {
61
61
  "generate": "tsx src/codegen/generate-cli.ts",
@@ -0,0 +1,64 @@
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: Plan the members this pull request reaches
25
+ env:
26
+ BASE_SHA: '${{ github.event.pull_request.base.sha }}'
27
+ PR_NUMBER: '${{ github.event.pull_request.number }}'
28
+ GITHUB_TOKEN: '${{ github.token }}'
29
+ CHANT_RUNNER_KEY: '${{ secrets.CHANT_RUNNER_KEY }}'
30
+ run: chant ci run plan --in-place --no-push --base "$BASE_SHA" --pr "$PR_NUMBER" --env prod --gate pr-apply --forge forgejo
31
+ - name: Keep the plan report
32
+ if: always()
33
+ uses: https://code.forgejo.org/actions/upload-artifact@v3
34
+ with:
35
+ name: chant-pr-plan
36
+ path: .chant/pr
37
+ if-no-files-found: ignore
38
+ record:
39
+ if: github.event_name == 'push'
40
+ runs-on: docker
41
+ container: node:22
42
+ concurrency:
43
+ group: chant-record-prod
44
+ cancel-in-progress: false
45
+ steps:
46
+ - uses: https://code.forgejo.org/actions/checkout@v7
47
+ with:
48
+ fetch-depth: 0
49
+ - 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)
50
+ - name: Record the plan on the merged commit; nothing applies
51
+ env:
52
+ BASE_SHA: '${{ github.event.before }}'
53
+ GITHUB_TOKEN: '${{ github.token }}'
54
+ CHANT_RUNNER_KEY: '${{ secrets.CHANT_RUNNER_KEY }}'
55
+ run: |
56
+ if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then git fetch origin "main" && BASE_SHA="$(git merge-base FETCH_HEAD "$GITHUB_SHA")"; if [ "$BASE_SHA" = "$GITHUB_SHA" ]; then BASE_SHA="$(git rev-parse --verify --quiet "$GITHUB_SHA^" || echo 4b825dc642cb6eb9a060e54bf8d69288fbee4904)"; fi; fi; export BASE_SHA
57
+ chant ci run record --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge forgejo
58
+ - name: Keep the record report
59
+ if: always()
60
+ uses: https://code.forgejo.org/actions/upload-artifact@v3
61
+ with:
62
+ name: chant-pr-record
63
+ path: .chant/pr
64
+ if-no-files-found: ignore
@@ -34,7 +34,7 @@ function hasActionlint(): boolean {
34
34
  }
35
35
 
36
36
  describe("the Forgejo pull-request workflow", () => {
37
- const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: {} });
37
+ const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true } });
38
38
 
39
39
  test("matches its golden", () => {
40
40
  if (process.env.UPDATE_GOLDEN) writeFileSync(GOLDEN, result.yaml);
@@ -64,7 +64,7 @@ describe("the Forgejo pull-request workflow", () => {
64
64
  });
65
65
 
66
66
  test("events and reportUrl reach Forgejo's jobs as they reach GitHub's (#4007)", () => {
67
- const yaml = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { events: true, reportUrl: "file:///srv/chant-reports" } }).yaml;
67
+ const yaml = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true, events: true, reportUrl: "file:///srv/chant-reports" } }).yaml;
68
68
  expect(yaml.match(/--forge forgejo --events-json --report-url "file:\/\/\/srv\/chant-reports"/g)).toHaveLength(2);
69
69
  expect(yaml.match(/CHANT_RUN_EVENTS_DIR: \.chant\/pr\/run-events/g)).toHaveLength(2);
70
70
  });
@@ -83,7 +83,7 @@ describe("the Forgejo pull-request workflow", () => {
83
83
  // v3 uploads hidden files with no input asking for it, so .chant/pr is still kept.
84
84
  expect(result.yaml).not.toContain("include-hidden-files");
85
85
  expect(result.yaml).toContain("path: .chant/pr");
86
- const github = generateGithubPipeline(ESTATE, { env: "prod", prLoop: {} }).yaml;
86
+ const github = generateGithubPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true } }).yaml;
87
87
  expect(github.match(/uses: actions\/upload-artifact@v4$/gm)).toHaveLength(2);
88
88
  expect(github).toContain("include-hidden-files: true");
89
89
  });
@@ -104,7 +104,7 @@ describe("the Forgejo pull-request workflow", () => {
104
104
  });
105
105
 
106
106
  describe("the forgejo pull-request pipeline with build (#4088)", () => {
107
- const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { build: true } });
107
+ const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true, build: true } });
108
108
  const doc = parseYAML(result.yaml) as Record<string, any>;
109
109
  const golden = join(import.meta.dirname, "__fixtures__", "pr-loop-build.forgejo.golden.yml");
110
110
 
@@ -122,14 +122,31 @@ describe("the forgejo pull-request pipeline with build (#4088)", () => {
122
122
  });
123
123
 
124
124
  test("buildCommand replaces the build line and turns the option on", () => {
125
- const yaml = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { buildCommand: "npm run build" } }).yaml;
125
+ const yaml = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true, buildCommand: "npm run build" } }).yaml;
126
126
  expect(yaml).toContain("npm run build");
127
127
  expect(yaml).not.toContain("chant build --env");
128
128
  expect(yaml).toContain("chant lint");
129
129
  });
130
130
 
131
131
  test("the default output carries neither line", () => {
132
- const plain = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: {} }).yaml;
132
+ const plain = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true } }).yaml;
133
133
  expect(plain).not.toContain("chant lint");
134
134
  });
135
135
  });
136
+
137
+ describe("the Forgejo pull-request workflow records on merge by default (#4168)", () => {
138
+ const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: {} });
139
+ const golden = join(import.meta.dirname, "__fixtures__", "pr-loop-record.forgejo.golden.yml");
140
+
141
+ test("matches its golden", () => {
142
+ if (process.env.UPDATE_GOLDEN) writeFileSync(golden, result.yaml);
143
+ expect(result.yaml).toBe(readFileSync(golden, "utf-8"));
144
+ });
145
+
146
+ test("a push runs ci run record against Forgejo, and nothing applies", () => {
147
+ expect(result.jobs.map((j) => j.jobName)).toEqual(["plan", "record"]);
148
+ expect(result.yaml).toContain('chant ci run record --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge forgejo');
149
+ expect(result.yaml).not.toContain("ci run apply");
150
+ expect(result.yaml).toContain("group: chant-record-prod");
151
+ });
152
+ });
@@ -21,7 +21,7 @@ const ESTATE: DriverComponent[] = [root("net"), root("app", ["net"])];
21
21
  const GOLDEN = join(import.meta.dirname, "__fixtures__", "pr-loop-waves.forgejo.golden.yml");
22
22
 
23
23
  describe("the Forgejo pull-request workflow with a gate per wave (#4003)", () => {
24
- const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: {}, gatedWaves: { gate: "release" } });
24
+ const result = generateForgejoPipeline(ESTATE, { env: "prod", prLoop: { applyOnMerge: true }, gatedWaves: { gate: "release" } });
25
25
  const doc = parseYAML(result.yaml) as { jobs: Record<string, { needs?: string[]; "runs-on": string; steps: Array<{ run?: string; uses?: string }> }> };
26
26
 
27
27
  test("matches its golden", () => {