Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/src/content/docs/reference/command-triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,36 @@ on:
on: /my-bot # Ultra-short: slash prefix automatically expands to slash_command + workflow_dispatch
```

## Multiple Command Identifiers

A single workflow can respond to multiple slash command names by providing an array of command identifiers:

```yaml wrap
on:
slash_command:
name: ["cmd.add", "cmd.remove", "cmd.list"]
```

When triggered, the matched command is available as `needs.activation.outputs.slash_command`, allowing your workflow to determine which command was used:

```aw wrap
---
on:
slash_command:
name: ["summarize", "summary", "tldr"]
permissions:
issues: write
---

# Multi-Command Handler

You invoked the workflow using: `/${{ needs.activation.outputs.slash_command }}`

Now analyzing the content...
```

This feature enables command aliases and grouped command handlers without workflow duplication.

> [!NOTE]
> **Deprecated Syntax**
>
Expand Down
60 changes: 59 additions & 1 deletion docs/src/content/docs/reference/safe-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ Choose one implementation method:
- **`script:`** - JavaScript (CommonJS) code
- **`run:`** - Shell script
- **`py:`** - Python script (Python 3.1x)
- **`go:`** - Go (Golang) code

You can only use one of `script:`, `run:`, or `py:` per tool.
You can only use one of `script:`, `run:`, `py:`, or `go:` per tool.

## JavaScript Tools (`script:`)

Expand Down Expand Up @@ -161,6 +162,63 @@ safe-inputs:

Python 3.10+ is available with standard library modules. Install additional packages inline using pip if needed.

## Go Tools (`go:`)

Go tools execute using `go run` with inputs provided as a `map[string]any` parsed from stdin. Standard library imports (`encoding/json`, `fmt`, `io`, `os`) are automatically included:

```yaml wrap
safe-inputs:
calculate:
description: "Perform calculations with Go"
inputs:
a:
type: number
required: true
b:
type: number
required: true
go: |
a := inputs["a"].(float64)
b := inputs["b"].(float64)
result := map[string]any{
"sum": a + b,
"product": a * b,
}
json.NewEncoder(os.Stdout).Encode(result)
```

Your Go code receives `inputs map[string]any` from stdin and should output JSON to stdout. The code is wrapped in a `package main` with a `main()` function that handles input parsing.

**Available by default:**
- `encoding/json` - JSON encoding/decoding
- `fmt` - Formatted I/O
- `io` - I/O primitives
- `os` - Operating system functionality

Access environment variables (including secrets) using `os.Getenv()`:

```yaml wrap
safe-inputs:
api-call:
description: "Call an API with Go"
inputs:
endpoint:
type: string
required: true
go: |
apiKey := os.Getenv("API_KEY")
endpoint := inputs["endpoint"].(string)

// Make your API call here
result := map[string]any{
"endpoint": endpoint,
"authenticated": apiKey != "",
}
json.NewEncoder(os.Stdout).Encode(result)
env:
API_KEY: "${{ secrets.API_KEY }}"
```

## Input Parameters

Define typed parameters with validation:
Expand Down