Add GitHub Copilot environment setup and increase test coverage to 87% - #4
Merged
Merged
Conversation
Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
Co-authored-by: marcelo-m7 <117441129+marcelo-m7@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Customize development environment for GitHub Copilot
Add GitHub Copilot environment setup and increase test coverage to 87%
Oct 27, 2025
marcelo-m7
marked this pull request as ready for review
October 27, 2025 11:14
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the need to configure GitHub Copilot's development environment and improve test coverage across the codebase.
Changes
Environment Setup
.github/workflows/copilot-setup-steps.ymlto pre-configure Python 3.10, install dependencies, and initialize the database before Copilot agents start workingworkflow_dispatch, push, and PR changes for validationTest Coverage: 70% → 87%
src/api.py: 93% → 99% — Added tests for school/area filters, pagination offset, and template fallbacksrc/scrape_ualg.py: 51% → 79% — Added tests for document download, error handling, module/area parsing, and scraping limitsTest Suite: 36 → 46 tests (+10)
API tests now cover:
Scraper tests now cover:
All tests pass. CodeQL reports zero vulnerabilities.
Original prompt
Can you create a Inssures setup the enviroment for developments, fix the remanings erros and improve the etest covering?
Customizing the development environment for GitHub Copilot coding agent
Learn how to customize GitHub Copilot's development environment with additional tools.
In this article
About customizing Copilot coding agent's 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
Set environment variables in Copilot's environment
Upgrade from standard GitHub-hosted GitHub Actions runners to larger runners
Enable Git Large File Storage (LFS)
Disable or customize the agent's firewall.
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:
pull_request:
paths:
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: readpermission. 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...
Created from VS Code via the GitHub Pull Request extension.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.