Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

Adds environment customization for GitHub Copilot coding agent to preinstall Java and Maven dependencies.

Changes

  • New workflow: .github/workflows/copilot-setup-steps.yml
    • Sets up JDK 8 (Temurin) matching project target
    • Caches Maven dependencies via setup-java's built-in cache
    • Pre-resolves dependencies with mvn dependency:resolve
    • Self-validates on push/PR to the workflow file
jobs:
  copilot-setup-steps:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        with:
          java-version: '8'
          distribution: 'temurin'
          cache: 'maven'
      - run: mvn dependency:resolve --batch-mode --no-transfer-progress
Original prompt

Customize the development environment for GitHub Copilot coding agent in this repository by adding a .github/workflows/copilot-setup-steps.yml file according to the official GitHub Copilot documentation below:

# Customizing the development environment for GitHub Copilot coding agent - GitHub Enterprise Cloud Docs

Learn how to customize GitHub Copilot's development environment with additional tools.

## [About customizing Copilot coding agent's development environment](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#about-customizing-copilot-coding-agents-development-environment)

While working on a task, Copilot has access to its own ephemeral development environment, powered by GitHub Actions, where it can explore your code, make changes, execute automated tests and linters and more.

You can customize Copilot's environment to:

-   [Preinstall tools or dependencies in Copilot's environment](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#preinstalling-tools-or-dependencies-in-copilots-environment)

-   [Set environment variables in Copilot's environment](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#setting-environment-variables-in-copilots-environment)
-   [Upgrade from standard GitHub-hosted GitHub Actions runners to larger runners](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#upgrading-to-larger-github-hosted-github-actions-runners)

-   [Enable Git Large File Storage (LFS)](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#enabling-git-large-file-storage-lfs)
-   [Disable or customize the agent's firewall](https://docs.github.com/en/enterprise-cloud@latest/copilot/customizing-copilot/customizing-or-disabling-the-firewall-for-copilot-coding-agent).

## [Preinstalling tools or dependencies in Copilot's environment](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#preinstalling-tools-or-dependencies-in-copilots-environment)

In its ephemeral development environment, Copilot can build or compile your project and run automated tests, linters and other tools. To do this, it will need to install your project's dependencies.

Copilot can discover and install these dependencies itself via a process of trial and error, but this can be slow and unreliable, given the non-deterministic nature of large language models (LLMs), and in some cases, it may be completely unable to download these dependencies—for example, if they are private.

Instead, you can preconfigure Copilot's environment before the agent starts by creating a special GitHub Actions workflow file, located at `.github/workflows/copilot-setup-steps.yml` within your repository.

A `copilot-setup-steps.yml` file looks like a normal GitHub Actions workflow file, but must contain a single `copilot-setup-steps` job. This job will be executed in GitHub Actions before Copilot starts working. For more information on GitHub Actions workflow files, see [Workflow syntax for GitHub Actions](https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-syntax-for-github-actions).

Note

The `copilot-setup-steps.yml` workflow won't trigger unless it's present on your default branch.

Here is a simple example of a `copilot-setup-steps.yml` file for a TypeScript project that clones the project, installs Node.js and downloads and caches the project's dependencies. You should customize this to fit your own project's language(s) and dependencies:

YAML

name: "Copilot Setup Steps"

Automatically run the setup steps when they are changed to allow for easy validation, and

allow manual testing through the repository's "Actions" tab

on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:

The job MUST be called copilot-setup-steps or it will not be picked up by Copilot.

copilot-setup-steps:
runs-on: ubuntu-latest

# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
  # If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
  contents: read

# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this...

💡 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.

@jaredmixpanel jaredmixpanel marked this pull request as ready for review December 1, 2025 22:05
Co-authored-by: jaredmixpanel <10504508+jaredmixpanel@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflow for Copilot setup Add copilot-setup-steps.yml for GitHub Copilot coding agent Dec 1, 2025
Copilot AI requested a review from jaredmixpanel December 1, 2025 22:10
@jaredmixpanel jaredmixpanel merged commit 31f6e25 into master Dec 1, 2025
18 checks passed
@jaredmixpanel jaredmixpanel deleted the copilot/add-copilot-setup-workflow branch December 1, 2025 22:15
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