From b8d63098527668718d86f237d24d78f18ec13918 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2026 11:18:05 +0000 Subject: [PATCH] docs: document gh aw logs --after flag and slash_command+bots warning - Add --after flag documentation to gh aw logs in cli.md, including usage examples for cache cleanup with date deltas and absolute dates - Add compile-time warning callout in command-triggers.md for the concurrency clash when slash_command and bots: are combined (PR #29008) Co-Authored-By: Claude Sonnet 4.6 --- .../content/docs/reference/command-triggers.md | 18 ++++++++++++++++++ docs/src/content/docs/setup/cli.md | 13 ++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/src/content/docs/reference/command-triggers.md b/docs/src/content/docs/reference/command-triggers.md index 97163e93447..44698968104 100644 --- a/docs/src/content/docs/reference/command-triggers.md +++ b/docs/src/content/docs/reference/command-triggers.md @@ -72,6 +72,24 @@ on: **Exception for Label-Only Events**: You CAN combine `slash_command` with `issues` or `pull_request` if those events are configured for label-only triggers (`labeled` or `unlabeled` types only). This allows workflows to respond to slash commands while also reacting to label changes. +### Combining `slash_command` with `bots:` + +:::caution[Concurrency clash] +Combining `slash_command` with `on.bots:` produces a compile-time warning. When a bot listed in `bots:` posts a comment that begins with the slash command text (e.g., `/command-name`), the command check passes and the bot triggers the workflow — occupying the concurrency slot and potentially blocking a simultaneous manual invocation, since `cancel-in-progress` is disabled for command-trigger workflows. + +To ensure the workflow only runs on explicit user commands, remove the `bots:` field. +::: + +```yaml wrap +# This configuration produces a compile-time warning: +on: + slash_command: + name: rust-review + events: [pull_request, pull_request_comment] + bots: + - "copilot[bot]" +``` + ```yaml wrap on: slash_command: deploy diff --git a/docs/src/content/docs/setup/cli.md b/docs/src/content/docs/setup/cli.md index e928484ce1e..0f03b6288a4 100644 --- a/docs/src/content/docs/setup/cli.md +++ b/docs/src/content/docs/setup/cli.md @@ -393,6 +393,17 @@ gh aw logs "CI Failure Doctor" # Display name gh aw logs "ci failure doctor" # Case-insensitive display name ``` +**`--after` flag (cache cleanup):** Deletes cached run folders in the output directory whose run creation date is older than the specified cutoff. Accepts the same date/time delta formats as `--start-date` and `--end-date` (e.g. `-1d`, `-1w`, `-1mo`) as well as absolute dates (`YYYY-MM-DD`). Cleanup runs before the download step to free disk space first; failures are non-fatal and logged as warnings. + +```bash wrap +gh aw logs --after -1w # Clean folders older than 1 week, then download latest runs +gh aw logs --after -30d # Clean folders older than 30 days +gh aw logs --after 2024-01-01 # Clean folders from before a specific date +gh aw logs my-workflow --after -1mo -c 20 # Clean up, then download 20 runs of a specific workflow +``` + +Only directories matching the `run-{ID}` naming pattern inside the output directory are considered. The run's creation timestamp is read from `run_summary.json` inside each folder; if that file is absent (e.g., incomplete download), the directory's modification time is used as a fallback. + **`--train` flag:** Trains log template weights from the downloaded runs and writes `drain3_weights.json` to the logs output directory. The trained weights improve anomaly detection accuracy in subsequent `gh aw audit` and `gh aw logs` runs. To embed weights into the binary as defaults, copy the file to `pkg/agentdrain/data/default_weights.json` and rebuild. ```bash wrap @@ -400,7 +411,7 @@ gh aw logs --train # Train on last 10 runs gh aw logs my-workflow --train -c 50 # Train on up to 50 runs of a specific workflow ``` -**Options:** `--after-run-id`, `--artifacts`, `--before-run-id`, `--count/-c`, `--end-date`, `--engine/-e`, `--filtered-integrity`, `--firewall`, `--format`, `--json/-j`, `--last`, `--no-firewall`, `--no-staged`, `--output/-o`, `--parse`, `--ref`, `--repo/-r`, `--safe-output`, `--start-date`, `--summary-file`, `--timeout`, `--tool-graph`, `--train` +**Options:** `--after`, `--after-run-id`, `--artifacts`, `--before-run-id`, `--count/-c`, `--end-date`, `--engine/-e`, `--filtered-integrity`, `--firewall`, `--format`, `--json/-j`, `--last`, `--no-firewall`, `--no-staged`, `--output/-o`, `--parse`, `--ref`, `--repo/-r`, `--safe-output`, `--start-date`, `--summary-file`, `--timeout`, `--tool-graph`, `--train` #### `audit`