Skip to content

Commit 1f35895

Browse files
authored
Merge branch 'main' into copilot/bump-firewall-to-v02742-and-mcpg-to-v046
2 parents a9ed6de + c0d6d98 commit 1f35895

4 files changed

Lines changed: 74 additions & 4 deletions

File tree

.github/workflows/cgo.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,10 +1299,6 @@ jobs:
12991299
make golint
13001300
fi
13011301
1302-
# Error message linting (requires Go only)
1303-
- name: Lint error messages
1304-
run: make lint-errors
1305-
13061302
# Enforce selected production custom analyzers without blocking on unrelated
13071303
# legacy custom analyzer findings in tests or other analyzer families.
13081304
# Note: -test=false intentionally scopes this gate to production code only.
@@ -1316,6 +1312,28 @@ jobs:
13161312
- name: Lint action shell scripts
13171313
run: make lint-action-sh
13181314

1315+
lint-error-messages:
1316+
runs-on: ubuntu-latest
1317+
timeout-minutes: 10
1318+
permissions:
1319+
contents: read
1320+
concurrency:
1321+
group: ci-${{ github.ref }}-lint-error-messages
1322+
cancel-in-progress: true
1323+
steps:
1324+
- name: Checkout code
1325+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1326+
1327+
- name: Set up Go
1328+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
1329+
with:
1330+
go-version-file: go.mod
1331+
cache: true
1332+
1333+
# Error message linting (requires Go only)
1334+
- name: Lint error messages
1335+
run: make lint-errors
1336+
13191337
actions-build:
13201338
runs-on: ubuntu-latest
13211339
timeout-minutes: 10
@@ -2434,6 +2452,7 @@ jobs:
24342452
- bench
24352453
- check-validator-sizes
24362454
- lint-go
2455+
- lint-error-messages
24372456
- actions-build
24382457
- fuzz
24392458
- security

actions/setup/js/collect_ndjson_output.cjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,16 @@ async function main() {
326326

327327
const typeConfig = expectedOutputTypes[itemType];
328328
const normalizeIssueClosingKeywords = typeConfig !== null && typeof typeConfig === "object" && typeConfig.normalize_closing_keywords === true;
329+
if (itemType === "dispatch_workflow") {
330+
const hasWorkflowName = typeof item.workflow_name === "string" && item.workflow_name.trim().length > 0;
331+
if (!hasWorkflowName && typeConfig !== null && typeof typeConfig === "object" && Array.isArray(typeConfig.workflows)) {
332+
const { workflows: configuredWorkflows } = typeConfig;
333+
if (configuredWorkflows.length === 1 && typeof configuredWorkflows[0] === "string" && configuredWorkflows[0].trim().length > 0) {
334+
item.workflow_name = configuredWorkflows[0].trim();
335+
core.info(`[INGESTION] Line ${i + 1}: Inferred dispatch_workflow workflow_name='${item.workflow_name}' from safe-outputs config`);
336+
}
337+
}
338+
}
329339

330340
// Use the validation engine to validate the item
331341
if (hasValidationConfig(itemType)) {

actions/setup/js/collect_ndjson_output.test.cjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ describe("collect_ndjson_output.cjs", () => {
119119
defaultMax: 1,
120120
fields: { tag: { type: "string", sanitize: !0, maxLength: 256 }, operation: { required: !0, type: "string", enum: ["replace", "append", "prepend"] }, body: { required: !0, type: "string", sanitize: !0, maxLength: 65e3 } },
121121
},
122+
dispatch_workflow: {
123+
defaultMax: 1,
124+
fields: {
125+
workflow_name: { required: !0, type: "string", sanitize: !0, minLength: 1, maxLength: 256, pattern: ".*\\S.*", patternError: "must not be empty" },
126+
inputs: { type: "object" },
127+
},
128+
},
122129
})
123130
));
124131
}),
@@ -195,6 +202,32 @@ describe("collect_ndjson_output.cjs", () => {
195202
const parsedOutput = JSON.parse(outputCall[1]);
196203
(expect(parsedOutput.items).toHaveLength(2), expect(parsedOutput.items[0].type).toBe("create_issue"), expect(parsedOutput.items[1].type).toBe("add_comment"), expect(parsedOutput.errors).toHaveLength(0));
197204
}),
205+
it("should infer dispatch_workflow workflow_name when one workflow is configured", async () => {
206+
const testFile = "/tmp/gh-aw/test-ndjson-output.txt",
207+
ndjsonContent = '{"type": "dispatch_workflow", "inputs": {"message": "hello"}}';
208+
(fs.writeFileSync(testFile, ndjsonContent), (process.env.GH_AW_SAFE_OUTPUTS = testFile));
209+
const __config = '{"dispatch_workflow":{"workflows":["workflow-handler"]}}',
210+
configPath = "/tmp/gh-aw/safeoutputs/config.json";
211+
(fs.mkdirSync("/tmp/gh-aw/safeoutputs", { recursive: !0 }), fs.writeFileSync(configPath, __config), await eval(`(async () => { ${collectScript}; await main(); })()`));
212+
const setOutputCalls = mockCore.setOutput.mock.calls,
213+
outputCall = setOutputCalls.find(call => "output" === call[0]);
214+
expect(outputCall).toBeDefined();
215+
const parsedOutput = JSON.parse(outputCall[1]);
216+
(expect(parsedOutput.items).toHaveLength(1), expect(parsedOutput.items[0].type).toBe("dispatch_workflow"), expect(parsedOutput.items[0].workflow_name).toBe("workflow-handler"), expect(parsedOutput.errors).toHaveLength(0));
217+
}),
218+
it("should not infer dispatch_workflow workflow_name when multiple workflows are configured", async () => {
219+
const testFile = "/tmp/gh-aw/test-ndjson-output.txt",
220+
ndjsonContent = '{"type": "dispatch_workflow", "inputs": {"message": "hello"}}';
221+
(fs.writeFileSync(testFile, ndjsonContent), (process.env.GH_AW_SAFE_OUTPUTS = testFile));
222+
const __config = '{"dispatch_workflow":{"workflows":["worker", " "]}}',
223+
configPath = "/tmp/gh-aw/safeoutputs/config.json";
224+
(fs.mkdirSync("/tmp/gh-aw/safeoutputs", { recursive: !0 }), fs.writeFileSync(configPath, __config), await eval(`(async () => { ${collectScript}; await main(); })()`));
225+
const setOutputCalls = mockCore.setOutput.mock.calls,
226+
outputCall = setOutputCalls.find(call => "output" === call[0]);
227+
expect(outputCall).toBeDefined();
228+
const parsedOutput = JSON.parse(outputCall[1]);
229+
expect(parsedOutput.errors).toHaveLength(1);
230+
}),
198231
it("should preserve Slack mrkdwn links in custom safe-job string inputs", async () => {
199232
const testFile = "/tmp/gh-aw/test-ndjson-output.txt";
200233
const slackText = "Tracking issue: <https://github.com/octo-org/octo-repo/issues/123|Build failure — Build github/gh-aw#456>";

cmd/gh-aw-wasm/main_stub.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//go:build !(js && wasm)
2+
3+
package main
4+
5+
// main is a no-op stub for non-wasm builds so the package compiles on the host
6+
// platform (e.g. for go build ./... and golangci-lint). The real entrypoint in
7+
// main.go is constrained to js/wasm.
8+
func main() {}

0 commit comments

Comments
 (0)