# Set Up GitHub Actions CI for a Blazor Web App

Yes. An agent writes a GitHub Actions workflow that restores, builds, checks formatting and EF Core migrations and publishes a Blazor Web App, then opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-github-actions-ci/blazor/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent works out what a green build should mean for this app before it writes YAML. In a Blazor Web App like `10.0/BlazorWebAppMovies` in dotnet/blazor-samples it reads `BlazorWebAppMovies.csproj`, which targets `net10.0` with nullable reference types on and pins five packages at 10.0.0, the one-project `BlazorWebAppMovies.slnx`, `Program.cs`, the `Migrations` folder with its model snapshot, and the `.editorconfig` at the repository root. It notes what is absent, because each absence changes the workflow: there is no `global.json`, so the workflow has to name the SDK itself; no `packages.lock.json`, so a NuGet cache can only be keyed on the project file; no test project, so there is nothing for `dotnet test` to run; and no workflow under `.github/workflows` that builds this app.

Every step is run in the sandbox before it goes into the file. The agent installs the .NET 10 SDK, runs `dotnet restore` and `dotnet build --no-restore --configuration Release`, and counts the warnings. If the build is clean it adds `-warnaserror` to the CI build so new warnings fail a pull request; if not, it leaves the flag off and lists the existing warnings instead of failing every branch on day one. It runs `dotnet publish --configuration Release` as well, since publishing a Blazor app does work a plain build does not, such as producing the static asset manifest that `MapStaticAssets` serves from.

Two checks are specific to this stack and are the reason to have the agent try them first. The formatting check, `dotnet format --verify-no-changes`, reads `.editorconfig`, and here that file asks for `crlf` line endings while the files in Git are stored with `lf`. On a Linux runner that mismatch can flag every file. The agent runs the command, and if line endings are what it reports, it limits the CI step to `dotnet format style` and `dotnet format analyzers` and raises the mismatch in the pull request for a maintainer to settle. The second check is `dotnet ef migrations has-pending-model-changes`, which fails when someone changes `Models/Movie.cs` without adding a migration. It compares the model with `BlazorWebAppMoviesContextModelSnapshot.cs`, and the agent confirms in the sandbox that it completes without a database, which matters because the only connection string in the repository points at a LocalDB instance no runner has.

The workflow it writes is one job on `ubuntu-latest`. It triggers on pull requests and on pushes to the default branch, sets `permissions` to `contents: read`, cancels a superseded run of the same branch with a `concurrency` group and has a `timeout-minutes`. The steps are checkout, `actions/setup-dotnet` with `dotnet-version: 10.0.x`, a cache of `~/.nuget/packages` keyed on the hash of the project file, restore, build, the format step, a tool restore for `dotnet-ef` from a `.config/dotnet-tools.json` the agent adds so the tool version is pinned, the migrations check, and publish. Action versions are the major tags current when the run happens, looked up from each action's releases. The file is checked with `actionlint` and the pull request states that adding a test project later needs one more step, `dotnet test --no-build`.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Set up GitHub Actions CI for this Blazor Web App. Read the .csproj, the solution file, Program.cs, the Migrations folder, .editorconfig, .github/dependabot.yml and any existing workflows first, and note whether there is a global.json, a packages.lock.json or a test project. In the sandbox, install the SDK the target framework needs and run dotnet restore, dotnet build --no-restore --configuration Release, dotnet format --verify-no-changes, dotnet ef migrations has-pending-model-changes and dotnet publish --configuration Release, and keep the output of each. Use -warnaserror in CI only if the build has no warnings today; otherwise list them. If the format check fails only on line endings because .editorconfig and the stored files disagree, scope the CI step to dotnet format style and dotnet format analyzers and report the mismatch without rewriting files. Pin dotnet-ef in a .config/dotnet-tools.json. Write .github/workflows/ci.yml as one job on ubuntu-latest for pull requests and pushes to the default branch, with read-only permissions, a concurrency group, a timeout, setup-dotnet for the right SDK band, a NuGet cache keyed on the project file, and the steps above in order. Look up the current major tag of each action. Run actionlint on the file and open a pull request with each command's output and anything you chose not to enforce.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

The pull request adds `.github/workflows/ci.yml` and `.config/dotnet-tools.json` and changes no application file. Its description walks through the job step by step with the output each command produced in the sandbox: the restore, the Release build with its warning count, the format result, the migrations check and the publish. Under a heading for things not enforced it lists whatever the agent held back and why, such as a whitespace check that would fail on line endings, or `-warnaserror` if the build was not clean.

Because the workflow triggers on pull requests, it runs on the pull request that introduces it, and that first run is the real proof. A reviewer looks at the run on the Checks tab, confirms the cache step saved on the first run, and decides the open questions the description raises: which line ending the repository wants, and whether warnings should fail the build. They also check that the workflow asks for no permission beyond reading the repository and that no secret is needed, since nothing here deploys.

## Run it on every terminal hand-off

This is a job a developer hands off in the middle of something else. From an MCP client in the terminal, `create_session` with this prompt and the repository starts the run, and the developer goes back to the feature branch. When it is time to look, `wait_for_sessions` returns the answer if the turn has ended, and `GET /o/{org}/sessions/{id}` names the pull request.

The sandbox parks when the turn ends, so the next request goes to the same session as a follow-up: add a bUnit test project and wire `dotnet test` into the job, or add a second job that builds the container image. Each follow-up continues from the workflow and tool manifest the first turn wrote.

## Why run it on Rush?

A CI workflow written from memory fails its first few runs on details: an SDK band the runner does not have, a format rule nobody knew the `.editorconfig` set, an EF tool that wants a connection. Each failure costs a push and a wait. The agent pays that cost in its own sandbox, where every command in the job is executed against the real repository first, and the output is attached to the pull request, so the first run on GitHub is expected to pass and the reviewer can see why.

It is also careful about what it turns on. A check that fails on the existing code teaches a team to ignore red, so the run enforces only what passes today and writes the rest down as decisions for a person. The transcript of the session keeps every command, which makes it easy to see how a step was verified months later when someone asks why it is there.

## Frequently asked questions

### Does the workflow run tests?

Only if the solution has a test project. This one does not, so the job builds, checks and publishes, and the pull request shows the single step to add once tests exist. A follow-up to the same session can add a bUnit project and that step together.

### Does the EF Core migrations check need a database in CI?

The agent verifies that in the sandbox instead of assuming it. `has-pending-model-changes` compares the current model with the snapshot file in the `Migrations` folder, and the run includes it only after it has completed there with no database available. If your design-time setup does connect, the agent says so and proposes a service container.

### Which runner does it use, Windows or Linux?

`ubuntu-latest`, the usual choice for a .NET build with no Windows-only dependency. If the project has a Windows-only dependency the agent finds it when the build fails in its Linux sandbox, and switches the job to `windows-latest` with the reason stated.

### Will it deploy the app as well?

Not in this run. The job ends at `dotnet publish`, which proves the app can be published. Deployment needs credentials and a target that are yours to choose, and a follow-up can add a deploy job once those exist as repository secrets.

## More Blazor jobs

- [Add Health Checks to a Blazor Web App](https://getrush.ai/run/add-health-checks/blazor/)
- [Add i18n to a Blazor Web App](https://getrush.ai/run/add-i18n/blazor/)
- [Migrate a Blazor App from SQL Server to PostgreSQL](https://getrush.ai/run/migrate-sql-server-to-postgres/blazor/)

## The same job on other stacks

- [Add GitHub Actions CI to a Bun App With a Postgres Test Database](https://getrush.ai/run/add-github-actions-ci/bun/)
- [Set Up GitHub Actions CI and Deploys for a Cloudflare Worker](https://getrush.ai/run/add-github-actions-ci/cloudflare-workers/)
- [Add GitHub Actions CI to a CMake Project](https://getrush.ai/run/add-github-actions-ci/cmake/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
