# Automatic jest test generation for GitHub PRs with OpenAI: n8n workflow

> Started by another system calling it, and works across GitHub. It hands the judgement calls to OpenAI. 20 steps: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/automatic-jest-test-generation-for-github-prs-with-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [AI assistants](https://millionrounds.com/workflows?category=AI+assistants#library)

# Automatic jest test generation for GitHub PRs with OpenAI

Started by another system calling it, and works across GitHub. It hands the judgement calls to OpenAI. 20 steps: a working afternoon to understand properly.

Medium Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomatic-jest-test-generation-for-github-prs-with-openai)

**20 steps** Medium: a working afternoon

**0** Branches: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 1 Model 6 Logic 8 Service 5

The steps in the order they run, from what starts it.

- 1 **GH - Get PR** Github *Service*
- 2 **Get Files** Github Tool *Service*
- 3 **Structured Output Parser** Output Parser Structured *Model*
- 4 **Get Repo** Github Tool *Service*
- 5 **o3-mini** Lm Chat Open Ai *Model*
- 6 **gpt4.1-mini** Lm Chat Open Ai *Model*
- 7 **Webhook** Webhook *Starts it*
- 8 **2nd Node for Testing** Code *Logic*
- 9 **Structured Output Parser1** Output Parser Structured *Model*
- 10 **Test Maker** Agent *Model*
- 11 **Code Reviewer** Agent *Model*
- 12 **Extrat API URL, owner and repo** Code *Logic*
- 13 **Merge** Merge *Logic*
- 14 **GET.diff file** Http Request *Service*
- 15 **Merge info needed** Merge *Logic*
- 16 **Prepare for POST** Code *Logic*
- 17 **Splits text into array** Code *Logic*
- 18 **Get File name** Code *Logic*
- 19 **POST Comments** Http Request *Service*
- 20 **FIlter for components** Code *Logic*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 20
- **Size:** Medium: a working afternoon
- **Connects to:** GitHub
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own GitHub account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 20 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 20 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fautomatic-jest-test-generation-for-github-prs-with-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[GitHub](https://millionrounds.com/workflows?service=GitHub#library)

## Workflows like it

Also ai assistants, with the same services where possible, closest in size first.

- [**Draft customer-facing changelogs from merged GitHub PRs** 20 steps · calls a model · GitHub, Gmail](https://millionrounds.com/workflow/draft-customer-facing-changelogs-from-merged-github-prs)
- [**AI-powered system for Creating & Executing your own Claude Skills** 24 steps · calls a model · GitHub](https://millionrounds.com/workflow/ai-powered-system-for-creating-and-executing-your-own-claude)
- [**Create a code assistant that learns from your GitHub repository** 16 steps · calls a model · GitHub, in-memory vectors](https://millionrounds.com/workflow/create-a-code-assistant-that-learns-from-your-github-reposit)
- [**Building RAG chatbot for movie recommendations with Qdrant** 25 steps · calls a model · GitHub, Qdrant](https://millionrounds.com/workflow/building-rag-chatbot-for-movie-recommendations-with-qdrant)
- [**Building RAG chatbot for movie recommendations with Qdrant** 25 steps · calls a model · GitHub, Qdrant](https://millionrounds.com/workflow/building-rag-chatbot-for-movie-recommendations-with-qdrant-2)
- [**README generator with GitHub** 14 steps · calls a model · GitHub](https://millionrounds.com/workflow/readme-generator-with-github)
