Add Copilot setup steps to install PG (#3752) #3
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
| name: "Copilot Setup Steps" | |
| # See https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment | |
| # 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 | |
| permissions: {} | |
| jobs: | |
| # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | |
| copilot-setup-steps: | |
| runs-on: ubuntu-24.04 | |
| # Install PostgreSQL via a docker container. | |
| # It's better to do this rather than e.g. use a testcontainer, because then the agent can reuse the same container | |
| # and instance of PostgreSQL rather than have to start it up each time it needs to iterate and run a test. | |
| services: | |
| postgres: | |
| image: postgis/postgis:latest | |
| ports: | |
| - 5432:5432 | |
| env: | |
| POSTGRES_PASSWORD: MySecret | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Export connection string for the agent's session | |
| run: echo "Test__Npgsql__DefaultConnection=Server=localhost;Database=postgres;Username=postgres;Password=MySecret" >> "$GITHUB_ENV" |