Skip to content

Add copilot-setup-steps.yml for workspace initialization#344

Merged
aldenks merged 3 commits intomainfrom
copilot/set-up-copilot-integration
Jan 6, 2026
Merged

Add copilot-setup-steps.yml for workspace initialization#344
aldenks merged 3 commits intomainfrom
copilot/set-up-copilot-integration

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

  • Create .github/workflows/copilot-setup-steps.yml as a complete GitHub Actions workflow
    • Include proper workflow structure with name, triggers, and job definition
    • Add copilot-setup-steps job (required name for Copilot to recognize it)
    • Include checkout step
    • Install uv using astral-sh/setup-uv action (matching code-quality.yml)
    • Install GDAL (gdal-bin only) to make gdalinfo available
    • Run uv run pre-commit install command
  • Remove incorrectly placed .github/copilot-setup-steps.yml file
Original prompt

Create a copilot-setup-steps.yml that


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add Copilot setup steps for UV and GDAL Add copilot-setup-steps.yml for workspace initialization Jan 6, 2026
Copilot AI requested a review from aldenks January 6, 2026 03:21
Copy link
Member

@aldenks aldenks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't follow the structure in the docs. Read this: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment

workflow should be located at .github/workflows/copilot-setup-steps.yml

Preinstalling tools or dependencies in Copilot's 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.

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 for you.
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: "npm"

      - name: Install JavaScript dependencies
        run: npm ci

In your copilot-setup-steps.yml file, you can only customize the following settings of the copilot-setup-steps job. If you try to customize other settings, your changes will be ignored.

steps (see above)
permissions (see above)
runs-on (see below)
services
snapshot
timeout-minutes (maximum value: 59)
For more information on these options, see Workflow syntax for GitHub Actions.

Any value that is set for the fetch-depth option of the actions/checkout action will be overridden to allow the agent to rollback commits upon request, while mitigating security risks. For more information, see actions/checkout/README.md.

Your copilot-setup-steps.yml file will automatically be run as a normal GitHub Actions workflow when changes are made, so you can see if it runs successfully. This will show alongside other checks in a pull request where you create or modify the file.

Once you have merged the yml file into your default branch, you can manually run the workflow from the repository's Actions tab at any time to check that everything works as expected. For more information, see Manually running a workflow.

When Copilot starts work, your setup steps will be run, and updates will show in the session logs. See Tracking GitHub Copilot's sessions.

If any setup step fails by returning a non-zero exit code, Copilot will skip the remaining setup steps and begin working with the current state of its development environment.

- name: Install GDAL
run: |
sudo apt-get update -qy
sudo apt-get install -qy -o APT::Install-Suggests=false libgdal-dev gdal-bin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sudo apt-get install -qy -o APT::Install-Suggests=false libgdal-dev gdal-bin
sudo apt-get install -qy -o APT::Install-Suggests=false gdal-bin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in commit 32bb3d6. Removed libgdal-dev and kept only gdal-bin.

Copy link
Contributor Author

Copilot AI commented Jan 6, 2026

This doesn't follow the structure in the docs. Read this: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment

workflow should be located at .g...

Fixed in commit 32bb3d6. Moved the file to .github/workflows/copilot-setup-steps.yml and converted it to a complete GitHub Actions workflow with the required copilot-setup-steps job structure.

Copilot AI requested a review from aldenks January 6, 2026 03:30
@aldenks aldenks marked this pull request as ready for review January 6, 2026 03:33
@aldenks aldenks enabled auto-merge (squash) January 6, 2026 03:35
@aldenks aldenks merged commit c473cd6 into main Jan 6, 2026
7 checks passed
@aldenks aldenks deleted the copilot/set-up-copilot-integration branch January 6, 2026 03:39
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