Skip to main content

Workflows Quick Start

In this tutorial, you'll create a workflow that automates GitHub Pull Request reviews. It shows how to combine CLI tools, file analysis, and user interaction.

Prerequisites

  • Careti installed
  • GitHub CLI (gh) installed and authenticated
  • A Git repository with a PR to test

Create a PR Review Workflow

This workflow fetches PR info, analyzes changes, and drafts review comments.

Create the workflow file

Create a project-specific workflow directory.

  1. Create .agents/context/workflows in the project root
  2. Create pr-review.md inside that folder

Write the workflow content

Add the content below to pr-review.md.

# Pull Request Reviewer

This workflow helps me review a pull request by analyzing the changes and drafting a review.

## 1. Gather PR Information
First, I need to understand what this PR is about. I'll fetch the title, description, and list of changed files.

```bash
gh pr view PR_NUMBER --json title,body,files
```

## 2. Examine Modified Files
Now I will examine the diff to understand the specific code changes.

```bash
gh pr diff PR_NUMBER
```

## 3. Analyze Changes
I will analyze the code changes for:
* **Bugs:** Logic errors or edge cases.
* **Performance:** Inefficient loops or operations.
* **Security:** Vulnerabilities or unsafe practices.

## 4. Confirm Assessment
Based on my analysis, I will present my findings and ask how you want to proceed.

```xml
<ask_followup_question>
<question>I've reviewed PR #PR_NUMBER. Here is my assessment:

[Insert Analysis Here]

Do you want me to approve this PR, request changes, or just leave a comment?</question>
<options>["Approve", "Request Changes", "Comment", "Do nothing"]</options>
</ask_followup_question>
```

## 5. Execute Review
Finally, I will execute the review command based on your decision.

```bash
# If approving:
gh pr review PR_NUMBER --approve --body "Looks good to me! [Summary of analysis]"

# If requesting changes:
gh pr review PR_NUMBER --request-changes --body "Please address the following: [Issues list]"

# If commenting:
gh pr review PR_NUMBER --comment --body "[Comments]"
```
ℹ️Note

When running this workflow, replace PR_NUMBER with the actual PR number (e.g., /pr-review.md 123).

Run the workflow

Now you're ready to run it.

  1. Open the Careti chat panel
  2. Type /pr-review.md followed by the PR number (e.g., /pr-review.md 42)
  3. Careti fetches PR details, analyzes the code, and shows findings
💡Tip

When Careti runs commands like gh pr view, it may pause to show output. Click Proceed While Running to let Careti continue.

Other Common Use Cases

This is just a starting point. You can build workflows for many tasks, such as:

  • Creating components: Generate boilerplate for new files (React components, API endpoints)
  • Running tests: Run a test suite and summarize results
  • Deployment automation: Use tools like docker and kubectl
  • Guided refactors: Step through complex refactors

Look for repetitive tasks in your workflow and turn them into efficient Careti workflows.