chore: remove unused GitHub workflow (#13071)
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
# This is a reusable workflow that builds the CLI for multiple platforms.
|
||||
#
|
||||
# Platform Build Strategy:
|
||||
# - Linux standard (x86_64 + aarch64): Builds inside manylinux_2_28 container for glibc 2.28+ compat
|
||||
# - Linux Vulkan: Uses native Ubuntu 24.04 runners for newer Vulkan headers/tooling
|
||||
# - Linux musl: Uses native Ubuntu 22.04 runners with reduced features for musl compatibility
|
||||
# - macOS: Uses bundle-macos.yml to package CLI artifacts without Desktop
|
||||
# - Windows: Uses bundle-windows.yml to package CLI artifacts without Desktop
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
ref:
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
name: "Reusable workflow to build CLI"
|
||||
|
||||
jobs:
|
||||
build-cli-macos:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- x86_64-apple-darwin
|
||||
- aarch64-apple-darwin
|
||||
uses: ./.github/workflows/bundle-macos.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
version: ${{ inputs.version }}
|
||||
ref: ${{ inputs.ref }}
|
||||
target: ${{ matrix.target }}
|
||||
signing: false
|
||||
package_cli: true
|
||||
package_desktop: false
|
||||
|
||||
build-cli-windows:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
windows_variant:
|
||||
- standard
|
||||
- cuda
|
||||
uses: ./.github/workflows/bundle-windows.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
version: ${{ inputs.version }}
|
||||
ref: ${{ inputs.ref }}
|
||||
signing: false
|
||||
package_cli: true
|
||||
package_desktop: false
|
||||
windows_variant: ${{ matrix.windows_variant }}
|
||||
|
||||
build-cli-linux:
|
||||
uses: ./.github/workflows/build-cli-linux.yml
|
||||
permissions:
|
||||
contents: read
|
||||
with:
|
||||
version: ${{ inputs.version }}
|
||||
ref: ${{ inputs.ref }}
|
||||
package_desktop: false
|
||||
@@ -1,210 +0,0 @@
|
||||
name: Code Review
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
pr_number:
|
||||
description: 'PR number to review'
|
||||
required: true
|
||||
type: number
|
||||
oidc_proxy_url:
|
||||
description: 'OIDC proxy URL (overrides repo variable)'
|
||||
required: false
|
||||
type: string
|
||||
review_instructions:
|
||||
description: 'Instructions for the code review'
|
||||
required: false
|
||||
default: 'Review the changes for correctness'
|
||||
type: string
|
||||
# pull_request_target:
|
||||
# types: [opened, synchronize, reopened]
|
||||
|
||||
concurrency:
|
||||
group: code-review-${{ github.event.pull_request.number || github.event.inputs.pr_number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: Mint OIDC token
|
||||
id: oidc
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
TOKEN_AUDIENCE: goose-oidc-proxy
|
||||
with:
|
||||
script: |
|
||||
const token = await core.getIDToken(process.env.TOKEN_AUDIENCE);
|
||||
core.setOutput('token', token);
|
||||
core.setSecret(token);
|
||||
|
||||
- name: Gather PR metadata and diff
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
PR_NUMBER=${{ github.event.pull_request.number || github.event.inputs.pr_number }}
|
||||
mkdir -p /tmp/code-review
|
||||
|
||||
gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json title --jq '.title' > /tmp/code-review/title.txt
|
||||
gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json body --jq '.body // "(no description)"' > /tmp/code-review/body.txt
|
||||
gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json headRefOid --jq '.headRefOid' > /tmp/code-review/commit_id.txt
|
||||
gh pr diff "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" > /tmp/code-review/pr.diff
|
||||
|
||||
TITLE=$(cat /tmp/code-review/title.txt)
|
||||
BODY=$(cat /tmp/code-review/body.txt)
|
||||
printf '# %s\n\n## Description\n\n%s\n' "$TITLE" "$BODY" > /tmp/code-review/pr.md
|
||||
|
||||
- name: Write OIDC token to file
|
||||
run: echo "$OIDC_TOKEN" > /tmp/code-review/oidc-token.txt
|
||||
env:
|
||||
OIDC_TOKEN: ${{ steps.oidc.outputs.token }}
|
||||
|
||||
- name: Upload review inputs
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: code-review-inputs
|
||||
path: /tmp/code-review/
|
||||
retention-days: 1
|
||||
|
||||
review:
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
permissions: {}
|
||||
timeout-minutes: 15
|
||||
|
||||
container:
|
||||
image: ghcr.io/aaif-goose/goose:latest
|
||||
options: --user root
|
||||
env:
|
||||
HOME: /tmp/goose-home
|
||||
|
||||
steps:
|
||||
- name: Checkout base branch
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y ripgrep jq
|
||||
|
||||
- name: Download review inputs
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: code-review-inputs
|
||||
path: /tmp/code-review
|
||||
|
||||
- name: Install custom provider and run goose review
|
||||
env:
|
||||
GOOSE_PROVIDER: anthropic-oidc-proxy
|
||||
GOOSE_MODEL: ${{ vars.GOOSE_CODE_REVIEW_MODEL || 'claude-opus-4-6' }}
|
||||
OIDC_PROXY_URL: ${{ github.event.inputs.oidc_proxy_url || vars.OIDC_PROXY_URL }}
|
||||
REVIEW_INSTRUCTIONS: ${{ github.event.inputs.review_instructions || 'Review the changes for correctness' }}
|
||||
run: |
|
||||
ANTHROPIC_OIDC_PROXY_API_KEY=$(cat /tmp/code-review/oidc-token.txt)
|
||||
export ANTHROPIC_OIDC_PROXY_API_KEY
|
||||
rm /tmp/code-review/oidc-token.txt
|
||||
|
||||
mkdir -p "$HOME/.local/share/goose/sessions"
|
||||
mkdir -p "$HOME/.config/goose/custom_providers"
|
||||
cp oidc-proxy/anthropic-oidc-proxy.json "$HOME/.config/goose/custom_providers/"
|
||||
|
||||
goose run \
|
||||
--recipe .github/recipes/code-review.yaml \
|
||||
--params pr_directory=/tmp/code-review \
|
||||
--params instructions="$REVIEW_INSTRUCTIONS"
|
||||
|
||||
- name: Upload review output
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: code-review-output
|
||||
path: |
|
||||
/tmp/conclusion.json
|
||||
/tmp/comments.json
|
||||
if-no-files-found: ignore
|
||||
retention-days: 30
|
||||
|
||||
submit:
|
||||
needs: [prepare, review]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
if: always() && needs.review.result == 'success'
|
||||
|
||||
steps:
|
||||
- name: Download review inputs
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: code-review-inputs
|
||||
path: /tmp/inputs
|
||||
|
||||
- name: Download review output
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: code-review-output
|
||||
path: /tmp/output
|
||||
|
||||
- name: Submit review
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}
|
||||
run: |
|
||||
CONCLUSION="/tmp/output/conclusion.json"
|
||||
COMMENTS="/tmp/output/comments.json"
|
||||
COMMIT_ID=$(cat /tmp/inputs/commit_id.txt)
|
||||
|
||||
if [ ! -f "$COMMENTS" ]; then
|
||||
echo "No comments produced, skipping review submission."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f "$CONCLUSION" ]; then
|
||||
echo '{"body":"","event":"COMMENT"}' > "$CONCLUSION"
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg commit_id "$COMMIT_ID" \
|
||||
--slurpfile conclusion "$CONCLUSION" \
|
||||
--slurpfile comments "$COMMENTS" \
|
||||
'{
|
||||
commit_id: $commit_id,
|
||||
event: $conclusion[0].event,
|
||||
comments: $comments[0]
|
||||
}
|
||||
| if $conclusion[0].body != "" then .body = $conclusion[0].body else . end
|
||||
' > /tmp/review-payload.json
|
||||
|
||||
if gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \
|
||||
--input /tmp/review-payload.json; then
|
||||
echo "Review submitted with inline comments."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Inline comments failed, folding into review body."
|
||||
|
||||
jq -n \
|
||||
--arg commit_id "$COMMIT_ID" \
|
||||
--slurpfile conclusion "$CONCLUSION" \
|
||||
--slurpfile comments "$COMMENTS" \
|
||||
'{
|
||||
commit_id: $commit_id,
|
||||
body: (
|
||||
$conclusion[0].body + "\n\n---\n\n## Inline Comments\n\n" +
|
||||
([$comments[0][] |
|
||||
"### `" + .path + "` (line " + (.line | tostring) + ")\n\n" + .body
|
||||
] | join("\n\n---\n\n"))
|
||||
),
|
||||
event: $conclusion[0].event
|
||||
}' \
|
||||
| gh api \
|
||||
--method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/reviews" \
|
||||
--input -
|
||||
@@ -1,304 +0,0 @@
|
||||
# Automatically updates the CLI Commands Guide when CLI commands or options
|
||||
# change between releases.
|
||||
#
|
||||
# Triggers: Manual (for testing) or on release (production)
|
||||
# Testing: Use dry_run mode to review outputs without creating PRs
|
||||
# See: documentation/automation/cli-command-tracking/TESTING.md
|
||||
|
||||
name: Update CLI Documentation
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Manual trigger for testing
|
||||
inputs:
|
||||
old_version:
|
||||
description: 'Previous version (e.g., v1.14.0). Leave empty to auto-detect.'
|
||||
required: false
|
||||
type: string
|
||||
new_version:
|
||||
description: 'New version (e.g., v1.15.0). Leave empty to use HEAD.'
|
||||
required: false
|
||||
type: string
|
||||
dry_run:
|
||||
description: 'Dry run mode - generate files but do not create PR'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
# Automatic triggering on releases
|
||||
# Uses edited to catch when release-action updates the release with artifacts
|
||||
release:
|
||||
types: [edited]
|
||||
|
||||
permissions:
|
||||
contents: write # Create branches and commit files
|
||||
pull-requests: write # Create PRs
|
||||
|
||||
jobs:
|
||||
update-docs:
|
||||
name: Update CLI Documentation
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for version comparison
|
||||
fetch-tags: true # Fetch all tags so we can checkout version tags
|
||||
|
||||
- name: Fetch upstream tags (for forks)
|
||||
if: github.repository != 'aaif-goose/goose'
|
||||
run: |
|
||||
# Add upstream remote and fetch tags (only needed when testing in forks)
|
||||
git remote add upstream https://github.com/aaif-goose/goose.git || git remote set-url upstream https://github.com/aaif-goose/goose.git
|
||||
git fetch upstream --tags --force
|
||||
echo "✅ Fetched tags from upstream (fork mode)"
|
||||
echo "Total tags available: $(git tag | wc -l)"
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y jq ripgrep
|
||||
|
||||
- name: Set up Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install goose CLI
|
||||
run: |
|
||||
mkdir -p /home/runner/.local/bin
|
||||
curl -fsSL https://github.com/aaif-goose/goose/releases/download/stable/download_cli.sh \
|
||||
| CONFIGURE=false GOOSE_BIN_DIR=/home/runner/.local/bin bash
|
||||
echo "/home/runner/.local/bin" >> $GITHUB_PATH
|
||||
goose --version
|
||||
|
||||
- name: Configure goose for CI
|
||||
env:
|
||||
GOOSE_PROVIDER: ${{ vars.GOOSE_PROVIDER || 'anthropic' }}
|
||||
GOOSE_MODEL: ${{ vars.GOOSE_MODEL || 'claude-opus-4-5' }}
|
||||
run: |
|
||||
mkdir -p ~/.config/goose
|
||||
cat <<EOF > ~/.config/goose/config.yaml
|
||||
GOOSE_PROVIDER: $GOOSE_PROVIDER
|
||||
GOOSE_MODEL: $GOOSE_MODEL
|
||||
keyring: false
|
||||
EOF
|
||||
|
||||
# Also export into the job environment so later steps can log the values
|
||||
echo "GOOSE_PROVIDER=$GOOSE_PROVIDER" >> "$GITHUB_ENV"
|
||||
echo "GOOSE_MODEL=$GOOSE_MODEL" >> "$GITHUB_ENV"
|
||||
|
||||
echo "✅ Created goose config:"
|
||||
cat ~/.config/goose/config.yaml
|
||||
|
||||
- name: Determine versions to compare
|
||||
id: versions
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
INPUT_OLD_VERSION: ${{ github.event.inputs.old_version }}
|
||||
INPUT_NEW_VERSION: ${{ github.event.inputs.new_version }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: |
|
||||
get_previous_release() {
|
||||
gh release list --limit 2 --json tagName --jq '.[].tagName' | sed -n '2p'
|
||||
}
|
||||
|
||||
if [ -n "$INPUT_OLD_VERSION" ]; then
|
||||
OLD_VERSION="$INPUT_OLD_VERSION"
|
||||
else
|
||||
OLD_VERSION=$(get_previous_release)
|
||||
fi
|
||||
|
||||
if [ -n "$INPUT_NEW_VERSION" ]; then
|
||||
NEW_VERSION="$INPUT_NEW_VERSION"
|
||||
elif [ "$EVENT_NAME" = "release" ]; then
|
||||
NEW_VERSION="$RELEASE_TAG"
|
||||
else
|
||||
NEW_VERSION="HEAD" # For testing unreleased changes
|
||||
fi
|
||||
|
||||
if [ -z "$OLD_VERSION" ] || [ -z "$NEW_VERSION" ]; then
|
||||
echo "Error: Could not determine versions to compare"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "OLD_VERSION=$OLD_VERSION" >> $GITHUB_ENV
|
||||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
|
||||
|
||||
echo "✅ Comparing $OLD_VERSION → $NEW_VERSION"
|
||||
|
||||
- name: Extract and compare CLI structures
|
||||
id: extract
|
||||
timeout-minutes: 30 # Building goose takes time
|
||||
working-directory: documentation/automation/cli-command-tracking
|
||||
env:
|
||||
GOOSE_REPO: ${{ github.workspace }}
|
||||
run: |
|
||||
set -o pipefail # Ensure pipeline failures are caught
|
||||
|
||||
mkdir -p output
|
||||
./scripts/run-pipeline.sh "$OLD_VERSION" "$NEW_VERSION" 2>&1 | tee output/pipeline.log
|
||||
|
||||
HAS_CHANGES=$(jq -r '.has_changes' output/cli-changes.json)
|
||||
echo "has_changes=$HAS_CHANGES" >> $GITHUB_OUTPUT
|
||||
|
||||
if [ "$HAS_CHANGES" = "false" ]; then
|
||||
echo "✅ No changes detected"
|
||||
else
|
||||
echo "✅ Changes detected"
|
||||
fi
|
||||
|
||||
- name: Update goose-cli-commands.md (AI synthesis)
|
||||
if: steps.extract.outputs.has_changes == 'true'
|
||||
timeout-minutes: 10
|
||||
working-directory: documentation/automation/cli-command-tracking/output
|
||||
env:
|
||||
CLI_COMMANDS_PATH: ${{ github.workspace }}/documentation/docs/guides/goose-cli-commands.md
|
||||
run: |
|
||||
echo "🔍 Environment diagnostics:"
|
||||
echo " GOOSE_PROVIDER: $GOOSE_PROVIDER"
|
||||
echo " GOOSE_MODEL: $GOOSE_MODEL"
|
||||
echo " ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:0:8}..." # Show first 8 chars only
|
||||
echo " CLI_COMMANDS_PATH: $CLI_COMMANDS_PATH"
|
||||
echo " HOME: $HOME"
|
||||
echo " PATH: $PATH"
|
||||
echo ""
|
||||
echo "📁 Goose config file:"
|
||||
cat ~/.config/goose/config.yaml || echo "Config file not found!"
|
||||
echo ""
|
||||
echo "📁 Current directory:"
|
||||
pwd
|
||||
ls -la
|
||||
echo ""
|
||||
echo "🤖 Applying changes to goose-cli-commands.md..."
|
||||
goose run --recipe ../recipes/update-cli-commands.yaml
|
||||
|
||||
- name: Upload automation outputs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: cli-docs-update-${{ steps.versions.outputs.old_version }}-to-${{ steps.versions.outputs.new_version }}
|
||||
path: |
|
||||
documentation/automation/cli-command-tracking/output/*.json
|
||||
documentation/automation/cli-command-tracking/output/*.md
|
||||
documentation/automation/cli-command-tracking/output/*.log
|
||||
retention-days: 30
|
||||
|
||||
- name: Create Pull Request
|
||||
if: |
|
||||
steps.extract.outputs.has_changes == 'true' &&
|
||||
(github.event.inputs.dry_run != 'true' || github.event_name == 'release')
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
branch: docs/auto-cli-commands-${{ steps.versions.outputs.new_version }}
|
||||
delete-branch: true
|
||||
|
||||
commit-message: |
|
||||
docs: Update CLI commands for ${{ steps.versions.outputs.new_version }}
|
||||
|
||||
Automated update based on CLI changes between ${{ steps.versions.outputs.old_version }} and ${{ steps.versions.outputs.new_version }}.
|
||||
|
||||
title: "docs: Update CLI Commands Guide for ${{ steps.versions.outputs.new_version }}"
|
||||
body: |
|
||||
## Summary
|
||||
|
||||
This PR updates the CLI Commands Guide based on command and option changes detected between **${{ steps.versions.outputs.old_version }}** and **${{ steps.versions.outputs.new_version }}**.
|
||||
|
||||
### Type of Change
|
||||
- [x] Documentation
|
||||
|
||||
### AI Assistance
|
||||
- [x] This PR was created or reviewed with AI assistance
|
||||
|
||||
#### 🤖 Automation Details
|
||||
|
||||
- **Workflow**: docs-update-cli-ref.yml
|
||||
- **Triggered by**: ${{ github.event_name }}
|
||||
- **Previous version**: ${{ steps.versions.outputs.old_version }}
|
||||
- **New version**: ${{ steps.versions.outputs.new_version }}
|
||||
|
||||
#### 📋 Changes Detected
|
||||
|
||||
Review the workflow artifacts for detailed change analysis:
|
||||
- cli-changes.json - Structured diff of changes
|
||||
- cli-changes.md - Human-readable change documentation
|
||||
- update-summary.md - Summary of documentation updates applied
|
||||
|
||||
Download artifacts from the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).
|
||||
|
||||
### ✅ Review Checklist
|
||||
|
||||
- [ ] Verify all CLI changes are accurately documented
|
||||
- [ ] Check that examples are updated correctly
|
||||
- [ ] Ensure new commands are in the correct sections
|
||||
- [ ] Confirm no unintended changes were made
|
||||
|
||||
### 🔗 Related
|
||||
|
||||
- Release: ${{ github.event.release.html_url || 'N/A' }}
|
||||
|
||||
---
|
||||
|
||||
*This PR was automatically generated by the CLI Documentation Automation workflow.*
|
||||
|
||||
labels: |
|
||||
documentation
|
||||
automated
|
||||
cli-commands
|
||||
|
||||
- name: Workflow summary
|
||||
if: always()
|
||||
env:
|
||||
OLD_VERSION: ${{ steps.versions.outputs.old_version }}
|
||||
NEW_VERSION: ${{ steps.versions.outputs.new_version }}
|
||||
HAS_CHANGES: ${{ steps.extract.outputs.has_changes }}
|
||||
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
|
||||
run: |
|
||||
echo "## 📊 CLI Documentation Update Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Version Comparison**: $OLD_VERSION → $NEW_VERSION" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Changes Detected**: $HAS_CHANGES" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Dry Run Mode**: $DRY_RUN" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
if [ "$HAS_CHANGES" = "true" ]; then
|
||||
echo "### ✅ Documentation Updated" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "The CLI Commands Guide has been updated to reflect changes in $NEW_VERSION." >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
echo "**Note**: Running in dry-run mode - no PR was created. Review the artifacts to see the generated changes." >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "A pull request has been created with the documentation updates." >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
else
|
||||
echo "### ℹ️ No Changes Needed" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "No CLI command changes were detected between $OLD_VERSION and $NEW_VERSION." >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### 📦 Artifacts" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Download the workflow artifacts to review:" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Extracted CLI structures" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Change detection results" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Human-readable change documentation" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Documentation update summary" >> $GITHUB_STEP_SUMMARY
|
||||
@@ -1,242 +0,0 @@
|
||||
name: goose Issue Solver
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
issue_number:
|
||||
description: 'Issue number to solve'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
GOOSE_RECIPE: |
|
||||
version: "1.0.0"
|
||||
title: "Solve GitHub Issue"
|
||||
description: "Solve GitHub issue #${ISSUE_NUMBER}"
|
||||
|
||||
extensions:
|
||||
- type: builtin
|
||||
name: developer
|
||||
- type: platform
|
||||
name: todo
|
||||
|
||||
instructions: |
|
||||
Write code like a senior goose contributor.
|
||||
|
||||
Principles:
|
||||
- Search first: `rg "keyword" -l` to find existing patterns. Copy them exactly.
|
||||
- Deletion is a feature: ask "can I delete code instead of adding?"
|
||||
- Complete changes: update ALL usages when changing a type. No exceptions.
|
||||
- When changing message types, update ALL provider format functions.
|
||||
- When changing ACP request/response types, run `just generate-acp-types`.
|
||||
- Your context degrades. The TODO is your memory. Update it after each step.
|
||||
|
||||
Types:
|
||||
- `PathBuf` for paths, never `String`
|
||||
- Enums for finite sets, never string comparisons
|
||||
- `Vec<T>` not `Option<Vec<T>>` - empty vec is the "none" case
|
||||
- Don't return `Result` if failure is meaningless
|
||||
- `#[serde(default)]` on new struct fields
|
||||
|
||||
Patterns:
|
||||
- Early returns, not nested if-else
|
||||
- Extract to utility if code appears 3+ times
|
||||
- Scope locks tightly: extract data, release lock, then I/O
|
||||
- Log and continue for non-critical failures
|
||||
- Error messages must say HOW to fix, not just what's wrong
|
||||
- Use `#[cfg(target_os = "...")]` for platform-specific code
|
||||
|
||||
Testing:
|
||||
- Bug fix: write failing test FIRST, then fix
|
||||
- Delete tests when deleting features
|
||||
- No tests for trivial code
|
||||
|
||||
Don't:
|
||||
- Create abstractions unless required
|
||||
- Add backward compat shims - update callers
|
||||
- Write WHAT comments (keep WHY comments)
|
||||
- Add checks the OS will do anyway
|
||||
|
||||
prompt: |
|
||||
Solve GitHub issue #${ISSUE_NUMBER}: ${ISSUE_TITLE}
|
||||
|
||||
The issue is saved at /tmp/issue.json
|
||||
|
||||
Trigger comment:
|
||||
${TRIGGER_COMMENT}
|
||||
|
||||
Write this to your TODO immediately and update as you progress:
|
||||
|
||||
## Phase 1: Understand
|
||||
- [ ] Read /tmp/issue.json
|
||||
- [ ] Write all requirements (explicit + implicit) to /tmp/requirements.md
|
||||
- [ ] Read AGENTS.md if it exists
|
||||
|
||||
## Phase 2: Research
|
||||
- [ ] `rg "keyword" -l` to find relevant files and similar patterns
|
||||
- [ ] `analyze path="crates/" focus="SymbolName"` to trace type/function usage
|
||||
- [ ] Read 2-3 similar implementations to copy their patterns
|
||||
- [ ] List all files that need changes in TODO
|
||||
|
||||
## Phase 3: Plan
|
||||
- [ ] Decide on implementation approach
|
||||
- [ ] If changing >5 files or public APIs, write plan to /tmp/plan.md first
|
||||
- [ ] Update TODO with specific changes to make
|
||||
|
||||
## Phase 4: Implement
|
||||
- [ ] Implement minimal fix per /tmp/requirements.md
|
||||
- [ ] Before adding anything, check: is it in the requirements? If not, don't.
|
||||
- [ ] No .github/, no lock files, no secrets
|
||||
|
||||
## Phase 5: Verify
|
||||
- [ ] source bin/activate-hermit
|
||||
- [ ] cargo check
|
||||
- [ ] cargo test (affected crates)
|
||||
- [ ] cargo fmt
|
||||
- [ ] cargo clippy --all-targets -- -D warnings
|
||||
- [ ] Fix failures, retry up to 3 times
|
||||
|
||||
## Phase 6: Confirm (MANDATORY)
|
||||
- [ ] Reread /tmp/issue.json
|
||||
- [ ] Reread /tmp/requirements.md
|
||||
- [ ] Confirm all requirements met, nothing extra added
|
||||
- [ ] Write a summary of changes to /tmp/issue_summary.txt
|
||||
|
||||
The Phase 6 "Reread" steps MUST appear in your updated TODO. Skipping them is failure.
|
||||
|
||||
Only write /tmp/issue_summary.txt if the fix is complete and verified.
|
||||
Run `git add` for any new files required for the fix.
|
||||
Do NOT commit. Leave changes in the working directory for the workflow to handle.
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
concurrency:
|
||||
group: goose-issue-${{ github.event.issue.number || github.event.inputs.issue_number }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
solve-issue:
|
||||
if: |
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(!github.event.issue.pull_request &&
|
||||
startsWith(github.event.comment.body, '/goose') &&
|
||||
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
|
||||
container:
|
||||
image: ghcr.io/aaif-goose/goose:latest
|
||||
options: --user root
|
||||
env:
|
||||
GOOSE_PROVIDER: ${{ vars.GOOSE_PROVIDER || 'anthropic' }}
|
||||
GOOSE_MODEL: ${{ vars.GOOSE_MODEL || 'claude-opus-4-5' }}
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
HOME: /tmp/goose-home
|
||||
|
||||
steps:
|
||||
- name: Acknowledge trigger
|
||||
if: github.event_name == 'issue_comment'
|
||||
run: |
|
||||
curl -sL -X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" \
|
||||
-d '{"content":"eyes"}'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: main
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y jq gettext curl build-essential pkg-config libssl-dev
|
||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install -y gh
|
||||
|
||||
- name: Get issue details (issue_comment)
|
||||
if: github.event_name == 'issue_comment'
|
||||
env:
|
||||
ISSUE_JSON: ${{ toJSON(github.event.issue) }}
|
||||
run: printenv ISSUE_JSON > /tmp/issue.json
|
||||
|
||||
- name: Get issue details (workflow_dispatch)
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh api /repos/${{ github.repository }}/issues/${{ github.event.inputs.issue_number }} > /tmp/issue.json
|
||||
|
||||
- name: Set issue outputs
|
||||
id: issue
|
||||
run: |
|
||||
echo "number=$(jq -r '.number' /tmp/issue.json)" >> $GITHUB_OUTPUT
|
||||
|
||||
# SECURITY: Use random delimiter to prevent injection if title contains our delimiter
|
||||
DELIMITER="EOF_$(openssl rand -hex 8)"
|
||||
echo "title<<$DELIMITER" >> $GITHUB_OUTPUT
|
||||
jq -r '.title' /tmp/issue.json >> $GITHUB_OUTPUT
|
||||
echo "$DELIMITER" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Run goose
|
||||
id: goose
|
||||
env:
|
||||
ISSUE_NUMBER: ${{ steps.issue.outputs.number }}
|
||||
ISSUE_TITLE: ${{ steps.issue.outputs.title }}
|
||||
TRIGGER_COMMENT: ${{ github.event.comment.body || 'Triggered via workflow_dispatch' }}
|
||||
run: |
|
||||
mkdir -p $HOME/.local/share/goose/sessions
|
||||
mkdir -p $HOME/.config/goose
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
echo "$GOOSE_RECIPE" | envsubst '$ISSUE_NUMBER $ISSUE_TITLE $TRIGGER_COMMENT' > /tmp/recipe.yaml
|
||||
|
||||
goose run --recipe /tmp/recipe.yaml
|
||||
|
||||
if [ -n "$(git status --porcelain)" ] && [ -f /tmp/issue_summary.txt ]; then
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
# SECURITY: Use random delimiter to prevent injection if summary contains our delimiter
|
||||
SUMMARY_DELIMITER="EOF_$(openssl rand -hex 8)"
|
||||
echo "summary<<$SUMMARY_DELIMITER" >> $GITHUB_OUTPUT
|
||||
cat /tmp/issue_summary.txt >> $GITHUB_OUTPUT
|
||||
echo "$SUMMARY_DELIMITER" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Verify no workflow changes
|
||||
if: steps.goose.outputs.has_changes == 'true'
|
||||
run: |
|
||||
if git diff --name-only | grep -q "^\.github/"; then
|
||||
echo "::error::Changes to .github/ are not allowed"
|
||||
git checkout -- .github/
|
||||
fi
|
||||
|
||||
- name: Create Pull Request
|
||||
if: steps.goose.outputs.has_changes == 'true'
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "fix: ${{ steps.issue.outputs.title }}"
|
||||
title: "fix: ${{ steps.issue.outputs.title }}"
|
||||
branch: goose/issue-${{ steps.issue.outputs.number }}
|
||||
delete-branch: true
|
||||
draft: true
|
||||
labels: goose-generated
|
||||
body: |
|
||||
Closes #${{ steps.issue.outputs.number }}
|
||||
|
||||
## Summary
|
||||
${{ steps.goose.outputs.summary || 'See commits for details.' }}
|
||||
|
||||
---
|
||||
*Generated by goose Issue Solver*
|
||||
@@ -1,323 +0,0 @@
|
||||
# goose PR Reviewer
|
||||
#
|
||||
# Automated PR review using goose AI agent.
|
||||
#
|
||||
# Trigger: Comment "/goose [optional instructions]" on a PR (OWNER/MEMBER only)
|
||||
#
|
||||
# Examples:
|
||||
# /goose
|
||||
# /goose focus on security implications
|
||||
# /goose check error handling in src/auth/
|
||||
#
|
||||
# Required Secrets:
|
||||
# - ANTHROPIC_API_KEY: API key for Anthropic
|
||||
#
|
||||
# Optional Variables:
|
||||
# - GOOSE_PROVIDER: LLM provider (default: anthropic)
|
||||
# - GOOSE_MODEL: Model name (default: claude-opus-4-5)
|
||||
#
|
||||
# Security:
|
||||
# - PR content could prompt-inject the agent; only trigger on PRs you trust.
|
||||
# - Do not add workflow_dispatch: API calls fetch mutable data, enabling TOCTOU attacks.
|
||||
|
||||
name: goose PR Reviewer
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
env:
|
||||
GOOSE_RECIPE: |
|
||||
version: "1.0.0"
|
||||
title: "Review Pull Request"
|
||||
description: "Review PR #${PR_NUMBER}"
|
||||
|
||||
extensions:
|
||||
- type: builtin
|
||||
name: developer
|
||||
- type: platform
|
||||
name: todo
|
||||
|
||||
instructions: |
|
||||
You are a code reviewer. Evaluate code, don't implement changes. Be constructive, specific, and verify claims with evidence.
|
||||
|
||||
## Issue Categories
|
||||
- 🔴 BLOCKING: Must fix. Requires HIGH confidence + code evidence.
|
||||
- 🟡 WARNING: Should fix. MEDIUM+ confidence.
|
||||
- 🟢 SUGGESTION: Nice to have. Can be speculative if labeled.
|
||||
- ✅ HIGHLIGHT: Good practices to acknowledge.
|
||||
|
||||
## Core Review Lens: "Succeed Fast" Detection
|
||||
LLM code often compiles quickly while avoiding proper design. Ask these questions:
|
||||
|
||||
**Necessity**: Do we need this?
|
||||
- New function? Could an existing one take an extra parameter?
|
||||
- New struct? Search `rg "struct Similar"` - does one exist?
|
||||
- New dependency? Many tools (gh, python) are pre-installed.
|
||||
|
||||
**Types & Options**: Is the type system being used correctly?
|
||||
- Option<T>: Why optional? If .unwrap() is nearby, it should be required.
|
||||
- Option<bool>: Rarely needed. Consider if None vs Some(false) distinction matters.
|
||||
- Manual JSON parsing: Use typed structs, not field extraction.
|
||||
- Many casts/assertions: The types are probably wrong.
|
||||
- Use builders: Prefer `Foo::builder()` over manual struct construction when available.
|
||||
- Generated types: Use API/SDK-provided types. Don't redefine what's already generated.
|
||||
- Path types: Use PathBuf for paths, not String. Use centralized path utilities.
|
||||
|
||||
**Duplication & State**: Is there one source of truth?
|
||||
- Similar code nearby? Factor it out.
|
||||
- Shadow state (settings in multiple places)? Consolidate.
|
||||
- Singleton caching config? What if config changes?
|
||||
|
||||
**Error Handling**: Are errors handled or hidden?
|
||||
- .ok(), .unwrap_or_default(), catch-and-log: Should this propagate?
|
||||
|
||||
## Code Hygiene
|
||||
- AI-generated artifacts: Verbose comments like "// Helper function to..." may be LLM leftovers. Delete if obvious.
|
||||
- Comments restating code: Delete. "Code speaks for itself."
|
||||
- Comments that lie: Dangerous. Fix or delete.
|
||||
- TODOs without owners: Create issue or delete.
|
||||
- Tests setting env vars: `rg "env::set_var" -g "*test*"` = flaky tests.
|
||||
- Tests not testing behavior: "What bug would this catch?"
|
||||
Ref: https://engineering.block.xyz/blog/the-high-cost-of-free-testing
|
||||
|
||||
## Security (especially workflows)
|
||||
- TOCTOU: Use event payload, not API calls.
|
||||
- Heredoc injection: User content may contain delimiter.
|
||||
- Feature auto-enable: Must respect user toggles.
|
||||
|
||||
## Architectural Smell (be specific about why)
|
||||
- Brittle: Too many special cases, hardcoded assumptions.
|
||||
- Wrong layer: Routes should be thin. Clients shouldn't know implementation details.
|
||||
- Not independent: Multiple booleans → should be enum.
|
||||
- Cumbersome: Simpler approach exists? Extend existing APIs.
|
||||
- Naming confusion: Similar functions should return similarly-named types (not FooResult vs ResultFoo).
|
||||
- Scope creep: Changes unrelated to PR's stated purpose.
|
||||
|
||||
## Anti-hallucination
|
||||
- Search with rg before claiming something is "missing"
|
||||
- Before claiming UI/frontend changes are needed, trace the actual data flow
|
||||
- Say "I couldn't verify" not "this is wrong"
|
||||
- 2 verified issues are better than 10 speculative ones
|
||||
|
||||
## Language Note
|
||||
These guidelines are primarily Rust-focused. For TypeScript/frontend changes (ui/desktop/),
|
||||
apply the same rigor with language-appropriate patterns (e.g., discriminated unions,
|
||||
optional chaining, React key uniqueness). Review all code equally thoroughly.
|
||||
|
||||
If the approach is fundamentally wrong, reject it. Don't polish bad code.
|
||||
|
||||
prompt: |
|
||||
Review PR #${PR_NUMBER}: ${PR_TITLE}
|
||||
|
||||
The PR metadata is saved at /tmp/pr.json
|
||||
The PR diff is saved at /tmp/pr.diff
|
||||
|
||||
The PR branch is already checked out. You are in the repository directory.
|
||||
Use the codebase to understand context - explore with analyze, rg, and file reads.
|
||||
|
||||
Reviewer instructions from trigger:
|
||||
${REVIEW_INSTRUCTIONS}
|
||||
|
||||
FIRST ACTION: Call todo_write with this entire checklist. Your memory degrades - the TODO is your only reliable memory. Update it frequently.
|
||||
|
||||
## Budget Guidance
|
||||
You have 15 minutes. Allocate effort wisely:
|
||||
- Phase 1 (Understand): ~20% - Don't over-explore, get the gist
|
||||
- Phase 2 (Evaluate): ~30% - This is where design issues surface
|
||||
- Phase 3 (Verify): ~30% - Only if approach is sound, skip if fundamentally flawed
|
||||
- Phase 4 (Report): ~20% - Prioritize and write concisely
|
||||
For large diffs (>500 lines): Focus on architecture over line-by-line review.
|
||||
Aim for 3-7 high-quality findings, not exhaustive coverage.
|
||||
|
||||
## PR Understanding
|
||||
- Intent: [fill after Phase 1]
|
||||
- Approach: [fill after Phase 1]
|
||||
- Evaluation: [fill after Phase 2 - is this the right approach?]
|
||||
|
||||
## Phase 1: Understand
|
||||
- [ ] Read /tmp/pr.json for PR description and context
|
||||
- [ ] Read /tmp/pr.diff for the actual changes
|
||||
- [ ] Read AGENTS.md if it exists
|
||||
- [ ] Note reviewer instructions: ${REVIEW_INSTRUCTIONS}
|
||||
- [ ] Summarize: What is this PR trying to accomplish?
|
||||
|
||||
## Phase 2: Evaluate (Empathize, then Challenge)
|
||||
First, empathize with the author's choices:
|
||||
- [ ] Trace the data/control flow through the changes
|
||||
- [ ] Why did the author choose this approach?
|
||||
- [ ] What constraints were they working under?
|
||||
|
||||
Then, challenge the approach:
|
||||
- [ ] Architectural fit: Does this fit naturally, or is there awkward "pretending"?
|
||||
- [ ] Alternatives: Could existing APIs/patterns be extended instead of adding new code?
|
||||
- [ ] Consistency: Do names/types match similar code? Search with: rg "similar_name" --type rust
|
||||
- [ ] Necessity: Is all this code needed? Could parameters/fields be removed?
|
||||
- [ ] State and intent: If this enables/disables features, does it respect user preferences?
|
||||
- [ ] Simpler path: Is there a way to achieve this with less code?
|
||||
|
||||
If fundamental design issues are found, note them and consider skipping detailed verification.
|
||||
|
||||
## Phase 3: Verify (only if approach is sound)
|
||||
- [ ] Review for correctness and logic errors
|
||||
- [ ] Check for security vulnerabilities
|
||||
- [ ] Assess error handling
|
||||
- [ ] Look for performance issues
|
||||
- [ ] Verify edge cases are handled
|
||||
- [ ] For each issue, add to Issues Found below with confidence level
|
||||
|
||||
Note: Do NOT run cargo check, cargo test, cargo fmt, or other build commands.
|
||||
CI pipelines already validate those automatically. Focus on code review only.
|
||||
|
||||
## Phase 4: Report
|
||||
- [ ] Prioritize findings: 🔴 Blocking > 🟡 Warning > 🟢 Suggestion
|
||||
- [ ] Verify all 🔴 BLOCKING issues have HIGH confidence + code evidence
|
||||
- [ ] Write review to /tmp/pr_review.md
|
||||
- [ ] Be concise - quality over quantity
|
||||
|
||||
## Issues Found
|
||||
[Add issues here as you find them, format: [HIGH/MED/LOW] [file:line] description - evidence]
|
||||
|
||||
---
|
||||
|
||||
Format your review in /tmp/pr_review.md as:
|
||||
|
||||
**Summary**: [1-2 sentence overview of what this PR does and your assessment]
|
||||
|
||||
Only include sections below if they have content. Omit empty sections entirely.
|
||||
|
||||
**🔴 Blocking Issues**
|
||||
[Issues that must be fixed before merge. Each must have file:line and evidence.]
|
||||
|
||||
**🟡 Warnings**
|
||||
[Issues that should be addressed]
|
||||
|
||||
**🟢 Suggestions**
|
||||
[Optional improvements]
|
||||
|
||||
**✅ Highlights**
|
||||
[Good practices observed in this PR]
|
||||
|
||||
---
|
||||
*Review generated by goose*
|
||||
|
||||
Only write /tmp/pr_review.md when the review is complete.
|
||||
Do NOT make any changes to the codebase.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: goose-pr-review-${{ github.event.issue.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
review-pr:
|
||||
if: |
|
||||
github.event.issue.pull_request &&
|
||||
startsWith(github.event.comment.body, '/goose') &&
|
||||
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
container:
|
||||
image: ghcr.io/aaif-goose/goose:latest
|
||||
options: --user root
|
||||
env:
|
||||
GOOSE_PROVIDER: ${{ vars.GOOSE_PROVIDER || 'anthropic' }}
|
||||
GOOSE_MODEL: ${{ vars.GOOSE_MODEL || 'claude-opus-4-5' }}
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
HOME: /tmp/goose-home
|
||||
|
||||
steps:
|
||||
- name: Acknowledge trigger
|
||||
run: |
|
||||
curl -sL -X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" \
|
||||
-d '{"content":"eyes"}'
|
||||
|
||||
- name: Checkout PR
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: refs/pull/${{ github.event.issue.number }}/head
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y gettext curl ripgrep
|
||||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||
apt-get update
|
||||
apt-get install -y gh
|
||||
|
||||
- name: Get PR diff
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh pr diff ${{ github.event.issue.number }} --repo ${{ github.repository }} > /tmp/pr.diff
|
||||
|
||||
- name: Extract review instructions
|
||||
id: instructions
|
||||
env:
|
||||
COMMENT_BODY: ${{ github.event.comment.body }}
|
||||
run: |
|
||||
if [ -n "$COMMENT_BODY" ]; then
|
||||
INSTRUCTIONS=$(echo "$COMMENT_BODY" | sed 's|^/goose||' | sed 's|^[[:space:]]*||' | sed 's|[[:space:]]*$||')
|
||||
fi
|
||||
|
||||
if [ -z "$INSTRUCTIONS" ]; then
|
||||
INSTRUCTIONS="No specific instructions - perform a general code review."
|
||||
fi
|
||||
|
||||
# SECURITY: Use random delimiter to prevent injection if comment contains our delimiter
|
||||
DELIMITER="EOF_$(openssl rand -hex 8)"
|
||||
echo "instructions<<$DELIMITER" >> $GITHUB_OUTPUT
|
||||
echo "$INSTRUCTIONS" >> $GITHUB_OUTPUT
|
||||
echo "$DELIMITER" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Run goose review
|
||||
id: goose
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.issue.number }}
|
||||
PR_TITLE: ${{ github.event.issue.title }}
|
||||
PR_BODY: ${{ github.event.issue.body }}
|
||||
REVIEW_INSTRUCTIONS: ${{ steps.instructions.outputs.instructions }}
|
||||
# SECURITY: Pass issue JSON via environment variable to avoid heredoc injection
|
||||
# (GHSA-mm8p-57gq-3xj6) - user-controlled content could terminate heredoc early
|
||||
ISSUE_JSON: ${{ toJson(github.event.issue) }}
|
||||
run: |
|
||||
mkdir -p $HOME/.local/share/goose/sessions
|
||||
mkdir -p $HOME/.config/goose
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
# SECURITY: Use printf with env var instead of heredoc to prevent injection
|
||||
printf '%s' "$ISSUE_JSON" > /tmp/pr.json
|
||||
|
||||
echo "$GOOSE_RECIPE" | envsubst '$PR_NUMBER $PR_TITLE $PR_BODY $REVIEW_INSTRUCTIONS' > /tmp/recipe.yaml
|
||||
|
||||
goose run --recipe /tmp/recipe.yaml
|
||||
|
||||
if [ -f /tmp/pr_review.md ]; then
|
||||
echo "has_review=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_review=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Post review comment
|
||||
if: steps.goose.outputs.has_review == 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh pr comment ${{ github.event.issue.number }} --repo ${{ github.repository }} --body-file /tmp/pr_review.md
|
||||
|
||||
- name: Post failure comment
|
||||
if: failure() || steps.goose.outputs.has_review != 'true'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh pr comment ${{ github.event.issue.number }} --repo ${{ github.repository }} --body "⚠️ goose PR review could not be completed. Check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details."
|
||||
Reference in New Issue
Block a user