Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/copilot-pr-merged-report.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .github/workflows/smoke-copilot-no-firewall.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .github/workflows/smoke-copilot-playwright.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .github/workflows/smoke-copilot-safe-inputs.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 4 additions & 14 deletions actions/setup/js/safe_output_types_validation.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import path from "path";

describe("Safe Output Types Validation", () => {
const typeDefsPath = path.join(__dirname, "types", "safe-outputs.d.ts");
const configDefsPath = path.join(
__dirname,
"types",
"safe-outputs-config.d.ts"
);
const configDefsPath = path.join(__dirname, "types", "safe-outputs-config.d.ts");

it("safe-outputs.d.ts should NOT contain github-token field", () => {
const content = fs.readFileSync(typeDefsPath, "utf-8");
Expand All @@ -40,9 +36,7 @@ describe("Safe Output Types Validation", () => {

// Verify it's in the right places (base config and safe job config)
const lines = content.split("\n");
const githubTokenLines = lines.filter((line) =>
line.includes('"github-token"')
);
const githubTokenLines = lines.filter(line => line.includes('"github-token"'));

// Should appear at least twice: once in SafeOutputConfig, once in SafeJobConfig
expect(githubTokenLines.length).toBeGreaterThanOrEqual(2);
Expand Down Expand Up @@ -95,9 +89,7 @@ describe("Safe Output Types Validation", () => {
const content = fs.readFileSync(typeDefsPath, "utf-8");

// Extract BaseSafeOutputItem definition
const baseInterfaceMatch = content.match(
/interface BaseSafeOutputItem\s*{([^}]*)}/
);
const baseInterfaceMatch = content.match(/interface BaseSafeOutputItem\s*{([^}]*)}/);
expect(baseInterfaceMatch).toBeTruthy();

if (baseInterfaceMatch) {
Expand All @@ -118,9 +110,7 @@ describe("Safe Output Types Validation", () => {
const content = fs.readFileSync(configDefsPath, "utf-8");

// Extract SafeOutputConfig definition
const baseInterfaceMatch = content.match(
/interface SafeOutputConfig\s*{([^}]*)}/
);
const baseInterfaceMatch = content.match(/interface SafeOutputConfig\s*{([^}]*)}/);
expect(baseInterfaceMatch).toBeTruthy();

if (baseInterfaceMatch) {
Expand Down
14 changes: 8 additions & 6 deletions pkg/workflow/safe_inputs_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ func collectSafeInputsSecrets(safeInputs *SafeInputsConfig) map[string]string {
// renderSafeInputsMCPConfigWithOptions generates the Safe Inputs MCP server configuration with engine-specific options
// Only supports HTTP transport mode
func renderSafeInputsMCPConfigWithOptions(yaml *strings.Builder, safeInputs *SafeInputsConfig, isLast bool, includeCopilotFields bool) {
envVars := getSafeInputsEnvVars(safeInputs)

yaml.WriteString(" \"" + constants.SafeInputsMCPServerID + "\": {\n")

// HTTP transport configuration - server started in separate step
Expand Down Expand Up @@ -98,13 +96,17 @@ func renderSafeInputsMCPConfigWithOptions(yaml *strings.Builder, safeInputs *Saf
yaml.WriteString(" \"tools\": [\"*\"],\n")
}

// Add env block for environment variable passthrough
envVarsWithServerConfig := append([]string{"GH_AW_SAFE_INPUTS_PORT", "GH_AW_SAFE_INPUTS_API_KEY"}, envVars...)
// Add env block for server configuration environment variables only
// Note: Tool-specific env vars (like GH_AW_GH_TOKEN) are already set in the step's env block
// and don't need to be passed through the MCP config since the server uses HTTP transport
yaml.WriteString(" \"env\": {\n")

// Only include server configuration variables
serverConfigVars := []string{"GH_AW_SAFE_INPUTS_PORT", "GH_AW_SAFE_INPUTS_API_KEY"}

// Write environment variables with appropriate escaping
for i, envVar := range envVarsWithServerConfig {
isLastEnvVar := i == len(envVarsWithServerConfig)-1
for i, envVar := range serverConfigVars {
isLastEnvVar := i == len(serverConfigVars)-1
comma := ""
if !isLastEnvVar {
comma = ","
Expand Down