Use Copilot to draft tests and check CI automatically

They let GitHub Copilot create tests and added automated checks in GitHub Actions, which reduced CI failures and sped up merges.

Done with GitHub Copilot· Intermediate

What they did
Working on a Node.js microservice, they sent GitHub issues to GitHub Copilot's coding agent and had it open draft pull requests with unit tests. After that, they left comments on the drafts so Copilot could revise them. In week 3, they changed the GitHub Actions pipeline to run Copilot review, inspect failing tests, and attempt vulnerability fixes, while branch protection still forced human review.
How it went
Across two weeks, CI test failures moved down from 18% to 9%. The average merge time also improved from 4.2 hours to 2.1 hours. A payment refactor caused 47 test breaks, and a dependency update got stuck in the pipeline.
Tips
Before wiring this into your own workflow, confirm the Copilot CLI commands you plan to use actually exist in your environment. The reported gains were the author's own rough two-week figures, so expect results to vary.

Try it yourself with GitHub Copilot

In [owner/repo], have GitHub Copilot draft unit tests for [service, package, or folder] using [test framework]. Open the work as a draft pull request, then stop and ask for my approval before you do anything that would merge, publish, or remove code. After I leave review comments, update the branch and keep iterating until the tests cover the main paths and edge cases. Next, show me how to extend the GitHub Actions workflow so each pull request gets Copilot code review plus a summary of failed tests and possible fixes, but pause again before changing the workflow file or turning on any step that could affect releases.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Read the original on dev.to ↗

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.