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:
- 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."

- name: Create a draft pull request
agent:
extends: pull_request
instructions: "Create a draft pull request for the changes made by the previous step."
tools:
- name: update_pull_request
extends: create_or_update_pull_request
with:
draft: true

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: An agent with the Coding extension is instructed to create a new file. It uses the {{ inputs.fileName }} and {{ inputs.fileContent }} templates to dynamically set the file's name and content based on your input.
  3. Create Pull Request Step: A dedicated pull_request agent is then used to create a draft pull request. The draft: true setting ensures the PR is created as a draft, ready for further review or updates.