Skip to main content

Simple Pull Request Workflow

This example shows how a Bosun task can create a file from user input and immediately open a draft pull request so reviewers see the change.

Workflow Definition (bosun.yaml)

name: create-file-and-pr-from-input
description: Creates a file with user-defined content and opens a draft pull request.

inputs:
fileName:
type: String
required: true
description: The name of the file to create (e.g., 'my-new-feature.md').
fileContent:
type: String
required: true
description: The content to write into the new file.

steps:
- id: create-file
name: Create a new file with provided content
agent:
extends: Coding
instructions: "Create a new file named '{{ inputs.fileName }}' in the root directory with the following content: '{{ inputs.fileContent }}'"
role: "You are a helpful assistant that creates files based on instructions."
constraints:
- "Ensure the file is created exactly as specified."
- "Do not make any other changes."

- id: open-pr
name: Create a draft pull request
agent:
extends: pull_request
instructions: "Create a draft pull request for the changes made in this run."
tools:
- name: update_pull_request
extends: create_or_update_pull_request
with:
draft: true

starts_with: create-file
ends_with: open-pr

edges:
- from: create-file
to: open-pr

How it Works

  1. Inputs: The workflow takes fileName and fileContent, so each run can target a new file and body.
  2. Create File Step: The create-file agent uses {{ inputs.fileName }} and {{ inputs.fileContent }} to create the requested file.
  3. Create Pull Request Step: The graph then follows the edge to open-pr, where a dedicated pull_request agent creates a draft pull request. The draft: true setting keeps the PR open for review or follow-up updates.