Skip to content

Ensure workspace directory is accessible to copilot engine in threat detection job#1211

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/ensure-workspace-dir-in-add-dir
Closed

Ensure workspace directory is accessible to copilot engine in threat detection job#1211
Copilot wants to merge 2 commits into
mainfrom
copilot/ensure-workspace-dir-in-add-dir

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 3, 2025

Problem

The threat detection job was unable to access workspace files when using the copilot engine. This occurred because:

  1. The detection job lacked a checkout step to populate $GITHUB_WORKSPACE
  2. The copilot CLI command only included --add-dir /tmp/ without the workspace directory

This meant the copilot engine in the detection job could not analyze repository files during threat detection, limiting its ability to understand the codebase context.

Solution

This PR adds workspace access to the copilot engine in two ways:

1. Added Checkout Step to Detection Job

The threat detection job now checks out the repository before running analysis:

detection:
  steps:
    - name: Checkout repository
      uses: actions/checkout@v5
    - name: Download agent output artifact
      # ...

2. Added Workspace Directory to Copilot CLI Arguments

The copilot engine now includes $GITHUB_WORKSPACE in its --add-dir arguments:

copilot --add-dir /tmp/ --add-dir "$GITHUB_WORKSPACE" --log-level all ...

This change applies to both the main agent job and the threat detection job, ensuring consistent workspace access across all copilot executions.

Testing

  • ✅ All existing tests pass
  • ✅ Updated copilot engine tests to verify workspace directory argument
  • ✅ Recompiled all affected workflows successfully
  • ✅ Verified generated workflow YAML includes both changes

Impact

This fix enables the threat detection job to properly analyze repository files when using the copilot engine, improving the security analysis capabilities of agentic workflows.

Original prompt

Ensure workspace dir is the in --add-dir in the copilot engine for the detection job


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…ection job

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for workspace dir in detection job Ensure workspace directory is accessible to copilot engine in threat detection job Oct 3, 2025
Copilot AI requested a review from pelikhan October 3, 2025 20:18
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented Oct 3, 2025

@pelikhan pelikhan closed this Oct 3, 2025
@pelikhan pelikhan deleted the copilot/ensure-workspace-dir-in-add-dir branch October 3, 2025 21:53
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