Skip to content

Commit 60e4072

Browse files
authored
Create goose.yml
1 parent cf6bf05 commit 60e4072

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/goose.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
3+
name: Goose
4+
5+
on:
6+
pull_request:
7+
types: [opened, synchronize, reopened, labeled]
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
issues: write
13+
14+
env:
15+
PROVIDER_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
16+
PR_NUMBER: ${{ github.event.pull_request.number }}
17+
GH_TOKEN: ${{ github.token }}
18+
19+
jobs:
20+
goose-comment:
21+
name: Goose Comment
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Gather PR information
30+
run: |
31+
{
32+
echo "# Files Changed"
33+
gh pr view $PR_NUMBER --json files \
34+
-q '.files[] | "* " + .path + " (" + (.additions|tostring) + " additions, " + (.deletions|tostring) + " deletions)"'
35+
echo ""
36+
echo "# Changes Summary"
37+
gh pr diff $PR_NUMBER
38+
} > changes.txt
39+
40+
- name: Install Goose CLI
41+
run: |
42+
mkdir -p /home/runner/.local/bin
43+
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh \
44+
| CONFIGURE=false INSTALL_PATH=/home/runner/.local/bin bash
45+
echo "/home/runner/.local/bin" >> $GITHUB_PATH
46+
47+
- name: Configure Goose
48+
run: |
49+
mkdir -p ~/.config/goose
50+
cat <<EOF > ~/.config/goose/config.yaml
51+
GOOSE_PROVIDER: google
52+
GOOSE_MODEL: gemini-2.0-flash-exp
53+
keyring: false
54+
EOF
55+
56+
- name: Create instructions for Goose
57+
run: |
58+
cat <<EOF > instructions.txt
59+
Create a summary of the changes provided. Don't provide any session or logging details.
60+
The summary for each file should be brief and structured as:
61+
<filename/path (wrapped in backticks)>
62+
- dot points of changes
63+
You don't need any extensions, don't mention extensions at all.
64+
The changes to summarise are:
65+
$(cat changes.txt)
66+
EOF
67+
68+
- name: Test
69+
run: cat instructions.txt
70+
71+
- name: Run Goose and filter output
72+
run: |
73+
goose run --instructions instructions.txt | \
74+
# Remove ANSI color codes
75+
sed -E 's/\x1B\[[0-9;]*[mK]//g' | \
76+
# Remove session/logging lines
77+
grep -v "logging to /home/runner/.config/goose/sessions/" | \
78+
grep -v "^starting session" | \
79+
grep -v "^Closing session" | \
80+
# Trim trailing whitespace
81+
sed 's/[[:space:]]*$//' \
82+
> pr_comment.txt
83+
84+
- name: Post comment to PR
85+
run: |
86+
cat -A pr_comment.txt
87+
gh pr comment $PR_NUMBER --body-file pr_comment.txt

0 commit comments

Comments
 (0)