Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

The safeoutputs MCP server running at the gateway lacked access to GitHub Actions context (workflow run, actor, event, ref information). This prevented context-aware operations that depend on the current PR, issue, or workflow state.

Changes

Environment Variables Added (21 total)

  • Run context: GITHUB_RUN_ID, GITHUB_RUN_NUMBER, GITHUB_RUN_ATTEMPT, GITHUB_JOB, GITHUB_ACTION
  • Event context: GITHUB_EVENT_NAME, GITHUB_EVENT_PATH
  • Actor context: GITHUB_ACTOR, GITHUB_ACTOR_ID, GITHUB_TRIGGERING_ACTOR
  • Workflow context: GITHUB_WORKFLOW, GITHUB_WORKFLOW_REF, GITHUB_WORKFLOW_SHA
  • Ref context: GITHUB_REF, GITHUB_REF_NAME, GITHUB_REF_TYPE, GITHUB_HEAD_REF, GITHUB_BASE_REF

Modified Files

  • pkg/workflow/mcp-config-builtin.go: Extended envVars slice in renderSafeOutputsMCPConfigWithOptions() and refactored renderSafeOutputsMCPConfigTOML() to programmatically build env_vars array
  • pkg/workflow/mcp_renderer.go: Updated renderSafeOutputsTOML() to include new variables using slice-based generation
  • pkg/workflow/mcp_servers.go: Added -e flags to Docker command generation for gateway container (lines 601-624)

Example Output

Docker command now includes all context variables:

-e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_EVENT_NAME \
-e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_BASE_REF ...

Variables propagate through three layers: MCP config JSON/TOML → gateway Docker command → safeoutputs container environment.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 21, 2026 04:16
…ateway

Added common GitHub Actions environment variables to the safeoutputs MCP server
when configured at the gateway, enabling access to workflow run context, actor
information, event details, and ref information.

Changes:
- Updated mcp-config-builtin.go to include additional env vars in envVars list
- Updated mcp_renderer.go TOML env_vars array for Codex engine
- Updated mcp_servers.go to pass env vars via -e flags in Docker command
- Variables added: GITHUB_RUN_*, GITHUB_JOB, GITHUB_ACTION, GITHUB_EVENT_*,
  GITHUB_ACTOR*, GITHUB_TRIGGERING_ACTOR, GITHUB_WORKFLOW*, GITHUB_REF*,
  GITHUB_HEAD_REF, GITHUB_BASE_REF

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Addressed code review feedback by refactoring long single-line environment
variable arrays into maintainable slice-based code. This improves readability
and makes it easier to maintain the environment variable lists.

Changes:
- Refactored renderSafeOutputsMCPConfigTOML to use a slice and loop
- Refactored renderSafeOutputsTOML to use the same approach
- Both functions now programmatically build the env_vars array
- No functional changes - output remains identical

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Add passing of GitHub action environment variables Pass GitHub Actions environment variables to safeoutputs MCP server at gateway Jan 21, 2026
Copilot AI requested a review from lpcox January 21, 2026 04:24
@lpcox lpcox marked this pull request as ready for review January 21, 2026 05:02
@lpcox lpcox merged commit be484ba into main Jan 21, 2026
116 checks passed
@lpcox lpcox deleted the copilot/pass-github-env-variables branch January 21, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants