Skip to content

Add comprehensive poem-bot agentic workflow with all features#1242

Merged
pelikhan merged 5 commits intomainfrom
copilot/create-poem-agentic-workflow
Oct 5, 2025
Merged

Add comprehensive poem-bot agentic workflow with all features#1242
pelikhan merged 5 commits intomainfrom
copilot/create-poem-agentic-workflow

Conversation

Copy link
Contributor

Copilot AI commented Oct 5, 2025

Overview

This PR adds a new poem-bot agentic workflow that demonstrates all available features in the GitHub Agentic Workflows system, including custom triggers, comprehensive safe-outputs configuration, cache-memory, network isolation, role-based access control, and template conditionals.

Features

Custom Triggers

The workflow supports multiple trigger mechanisms:

  1. Command Trigger: Responds to /poem-bot mentions in issues only (with events filter)
  2. Workflow Dispatch: Manual execution with customizable input:
    • poem_theme: Theme for the poem generation

Comprehensive Safe-Outputs (Staged Mode)

All 9 safe-output types are configured with staged: true for safe testing:

  • create-issue: Creates issues with poems (max 2 per run, custom prefix [🎭 POEM-BOT])
  • add-comment: Adds comments to issues/PRs (max 3, target: all)
  • update-issue: Updates issue status, title, and body (max 2)
  • add-labels: Applies poetry-themed labels (max 5 from 8 allowed labels)
  • create-pull-request: Creates PRs with poetry files (custom prefix [🎨 POETRY])
  • create-pull-request-review-comment: Adds review comments (max 2)
  • push-to-pull-request-branch: Pushes changes to PR branches
  • upload-assets: Uploads generated poetry assets
  • missing-tool: Reports unavailable tools

Security & Configuration

  • Roles: Restricted to admin and maintainer only
  • Network: Deny-all policy (network: {}) prevents external access
  • Cache-Memory: 30-day retention with custom key for persistent storage across runs
  • Engine: GitHub Copilot with gpt-5 model

Creative AI Prompt

The workflow instructs the AI to:

  • Generate original poetry about the provided context
  • Choose from 5 poetic forms (Haiku, Limerick, Sonnet, Free Verse, Couplets)
  • Reference specific details from triggering events
  • Use technical metaphors blending code and poetry
  • Leverage all safe-outputs capabilities appropriately

Template Conditionals

The workflow uses template regions to conditionally render content based on workflow inputs, demonstrating the {{#if ${{ expression }}}} conditional syntax for dynamic prompt generation. The template system evaluates GitHub Actions expressions first, then processes conditional blocks to include or exclude prompt content based on runtime values.

Usage

Users with admin or maintainer permissions can trigger the workflow by:

  1. Commenting /poem-bot on any issue
  2. Running manually via the Actions tab with custom theme input

The bot will generate original poems and use safe-outputs to create issues, add comments, apply labels, upload assets, and create pull requests as appropriate.

Files Added/Modified

  • .github/workflows/poem-bot.md (146 lines) - Source workflow definition
  • .github/workflows/poem-bot.lock.yml (compiled) - Compiled GitHub Actions workflow

Testing

  • ✅ Successfully compiles to 242.2 KB lock file
  • ✅ All unit tests pass
  • ✅ All integration tests pass
  • ✅ Linting and formatting validated
  • ✅ Template conditional syntax validated with proper GitHub Actions expression format

This workflow serves as a comprehensive example of the agentic workflow system's capabilities, including template conditionals for dynamic prompt generation, while providing a creative and fun use case for automated poetry generation.

Original prompt

Create a poem agentic workflow and

  • enable all custom triggers like command, label names, workflow_dispatch
  • enable all the safe outputs (staged)
  • use cache-memory
  • network {}
  • roles admin/maintainer

The prompt is to create a poem about the text in context.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add poem agentic workflow with custom triggers Add comprehensive poem-bot agentic workflow with all features Oct 5, 2025
Copilot AI requested a review from pelikhan October 5, 2025 16:38
# Workflow dispatch with label names input
workflow_dispatch:
inputs:
label_names:
Copy link
Contributor

@pelikhan pelikhan Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove this input


🤖 Workflow run triggered by this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed label_names input from workflow_dispatch. Commit: e4d7c3a


# AI engine configuration
engine:
id: claude
Copy link
Contributor

@pelikhan pelikhan Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use copilot engine and gpt5


🤖 Workflow run triggered by this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed engine to copilot with gpt-5 model (removed max-turns as it's not supported by copilot). Commit: e4d7c3a

…ot/gpt-5, add upload-assets, use template conditionals

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 5, 2025 17:12
- **Repository**: ${{ github.repository }}
- **Actor**: ${{ github.actor }}
- **Theme**: ${{ github.event.inputs.poem_theme }}
{{#if github.event.inputs.label_names}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The expression must be a github action expression

{{#if ${{ github... }} }}

  • update instructions.md accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed template conditional syntax to {{#if ${{ github.event.inputs.label_names }}}} and added comprehensive documentation to instructions.md explaining the syntax, how it works, truthy/falsy values, examples, and best practices. Commit: 9a8f2d1

… add documentation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 5, 2025 17:29

**Important**: The expression inside `{{#if}}` must be a complete GitHub Actions expression with `${{ }}` syntax. The workflow engine evaluates the `${{ }}` expression first, then processes the `{{#if}}` conditional based on the result.

### How It Works
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove the rest of the changes in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed Template Conditionals documentation from both instructions.md files. The workflow still uses the correct template syntax. Commit: fd8a6c2

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 5, 2025 17:44
@pelikhan pelikhan marked this pull request as ready for review October 5, 2025 17:53
@pelikhan pelikhan merged commit 65611d4 into main Oct 5, 2025
11 checks passed
@pelikhan pelikhan deleted the copilot/create-poem-agentic-workflow branch October 5, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants