Skip to content

Commit 7634c35

Browse files
committed
feat: initial setup-goose composite action
- Composite GitHub Action for installing Goose AI agent - Supports version pinning for reproducible CI/CD builds - Built-in caching for faster subsequent runs - Cross-platform support (Linux x64/arm64, macOS x64/arm64) - Zero external dependencies (pure YAML composite action) - Includes comprehensive README with examples - Self-testing workflow for validation - Addresses Goose issue #5167 (version pinning in CI/CD)
0 parents  commit 7634c35

5 files changed

Lines changed: 414 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Test Action
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-ubuntu:
12+
name: Test on Ubuntu
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Test action
19+
uses: ./
20+
id: goose
21+
with:
22+
version: '1.12.1'
23+
24+
- name: Verify installation
25+
run: |
26+
echo "Goose version: ${{ steps.goose.outputs.goose-version }}"
27+
echo "Goose path: ${{ steps.goose.outputs.goose-path }}"
28+
goose --version
29+
30+
- name: Test goose command
31+
run: |
32+
which goose
33+
goose --help
34+
35+
test-macos:
36+
name: Test on macOS
37+
runs-on: macos-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Test action
43+
uses: ./
44+
with:
45+
version: '1.12.1'
46+
47+
- name: Verify installation
48+
run: |
49+
goose --version
50+
which goose
51+
52+
test-cache:
53+
name: Test caching
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
59+
- name: First run (cache miss)
60+
uses: ./
61+
with:
62+
version: '1.12.1'
63+
64+
- name: Remove binary
65+
run: rm ~/.local/bin/goose
66+
67+
- name: Second run (cache hit)
68+
uses: ./
69+
with:
70+
version: '1.12.1'
71+
72+
- name: Verify cache worked
73+
run: goose --version
74+
75+
test-version:
76+
name: Test different version
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v4
81+
82+
- name: Test older version
83+
uses: ./
84+
with:
85+
version: '1.11.0'
86+
87+
- name: Verify correct version
88+
run: |
89+
VERSION=$(goose --version)
90+
echo "Installed: $VERSION"

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# OS
2+
.DS_Store
3+
.DS_Store?
4+
._*
5+
.Spotlight-V100
6+
.Trashes
7+
ehthumbs.db
8+
Thumbs.db
9+
10+
# IDE
11+
.vscode/
12+
.idea/
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Logs
18+
*.log

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Hugues Clouâtre
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
# Setup Goose Action
2+
3+
GitHub Action to install and cache [Goose AI agent](https://github.com/block/goose) for use in workflows.
4+
5+
## Usage
6+
7+
```yaml
8+
- uses: clouatre-labs/setup-goose-action@v1
9+
with:
10+
version: '1.12.1' # Optional, defaults to 1.12.1
11+
```
12+
13+
## Inputs
14+
15+
| Input | Description | Required | Default |
16+
|-------|-------------|----------|---------|
17+
| `version` | Goose version to install | No | `1.12.1` |
18+
19+
## Outputs
20+
21+
| Output | Description |
22+
|--------|-------------|
23+
| `goose-version` | Installed Goose version |
24+
| `goose-path` | Path to Goose binary directory |
25+
26+
## Examples
27+
28+
### Basic Usage
29+
30+
```yaml
31+
name: AI Code Review
32+
on: pull_request
33+
34+
jobs:
35+
review:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- uses: clouatre-labs/setup-goose-action@v1
41+
42+
- name: Run Goose
43+
env:
44+
GOOGLE_API_KEY: ${{ secrets.GEMINI_API_KEY }}
45+
run: goose session --profile ci
46+
```
47+
48+
### Specify Version
49+
50+
```yaml
51+
- uses: clouatre-labs/setup-goose-action@v1
52+
with:
53+
version: '1.11.0'
54+
```
55+
56+
### Use Outputs
57+
58+
```yaml
59+
- uses: clouatre-labs/setup-goose-action@v1
60+
id: goose
61+
62+
- name: Display version
63+
run: echo "Installed Goose ${{ steps.goose.outputs.goose-version }}"
64+
```
65+
66+
### Complete Workflow Example
67+
68+
```yaml
69+
name: Goose Logic Review
70+
on:
71+
pull_request:
72+
paths:
73+
- 'src/**'
74+
- 'tests/**'
75+
76+
permissions:
77+
contents: read
78+
pull-requests: write
79+
80+
jobs:
81+
review:
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
with:
86+
fetch-depth: 0
87+
88+
- uses: clouatre-labs/setup-goose-action@v1
89+
with:
90+
version: '1.12.1'
91+
92+
- name: Configure Goose
93+
run: |
94+
mkdir -p ~/.config/goose
95+
cat <<EOF > ~/.config/goose/config.yaml
96+
GOOSE_PROVIDER: google
97+
GOOSE_MODEL: gemini-2.0-flash-exp
98+
keyring: false
99+
EOF
100+
101+
- name: Get changed files
102+
id: changes
103+
run: |
104+
git diff --name-only origin/${{ github.base_ref }}...HEAD > changed_files.txt
105+
cat changed_files.txt
106+
107+
- name: Review with Goose
108+
env:
109+
GOOGLE_API_KEY: ${{ secrets.GEMINI_API_KEY }}
110+
run: |
111+
goose session --profile ci <<EOF
112+
Review the following changed files for logic issues:
113+
$(cat changed_files.txt)
114+
EOF
115+
```
116+
117+
## Features
118+
119+
- **Caching**: Automatically caches Goose binary for faster subsequent runs
120+
- **Version Pinning**: Install specific Goose versions for reproducible builds
121+
- **Cross-Platform**: Supports Linux (x64, arm64) and macOS (x64, arm64)
122+
- **Lightweight**: Composite action with no external dependencies
123+
124+
## Supported Platforms
125+
126+
| OS | Architecture | Status |
127+
|----|--------------|--------|
128+
| Ubuntu | x64 | ✅ Supported |
129+
| Ubuntu | arm64 | ✅ Supported |
130+
| macOS | x64 | ✅ Supported |
131+
| macOS | arm64 | ✅ Supported |
132+
| Windows | - | ❌ Not supported |
133+
134+
## How It Works
135+
136+
1. Checks cache for Goose binary matching the specified version and platform
137+
2. If cache miss, downloads Goose binary from official GitHub releases
138+
3. Extracts binary to `~/.local/bin/goose`
139+
4. Adds binary location to `$GITHUB_PATH`
140+
5. Verifies installation with `goose --version`
141+
142+
## Cache Key Format
143+
144+
```
145+
goose-{version}-{os}-{arch}
146+
```
147+
148+
Example: `goose-1.12.1-Linux-X64`
149+
150+
## Troubleshooting
151+
152+
### Binary not found after installation
153+
154+
Ensure you're using the action before attempting to run `goose`:
155+
156+
```yaml
157+
- uses: clouatre-labs/setup-goose-action@v1
158+
- run: goose --version # This will work
159+
```
160+
161+
### Unsupported version
162+
163+
Check available versions at [Goose Releases](https://github.com/block/goose/releases). Ensure the version exists and has pre-built binaries.
164+
165+
### Cache not working
166+
167+
The cache key includes OS and architecture. If you change runners or platforms, a new cache entry will be created. This is expected behavior.
168+
169+
## Development
170+
171+
This is a composite action (YAML-based) with no compilation required.
172+
173+
### Testing Locally
174+
175+
```bash
176+
# Test in a workflow
177+
git clone https://github.com/clouatre-labs/setup-goose-action
178+
cd setup-goose-action
179+
180+
# Create a test workflow in .github/workflows/test.yml
181+
# Push and verify the action works
182+
```
183+
184+
## Contributing
185+
186+
Contributions are welcome! Please open an issue or PR.
187+
188+
## License
189+
190+
MIT - See [LICENSE](LICENSE)
191+
192+
## Related
193+
194+
- [Goose](https://github.com/block/goose) - Official Goose repository
195+
- [Goose Documentation](https://block.github.io/goose/)
196+
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
197+
198+
## Acknowledgments
199+
200+
Built by [clouatre-labs](https://github.com/clouatre-labs) for the Goose community. Not officially affiliated with Block or the Goose project.

0 commit comments

Comments
 (0)