docs: fixed cicd tutorial pipeline in docs (#4223)
Signed-off-by: Bhanu Teja <109905113+bhanubokkasam@users.noreply.github.com>
This commit is contained in:
@@ -27,90 +27,93 @@ You can run Goose directly within GitHub Actions. Follow these steps to set up y
|
|||||||
|
|
||||||
```yaml title="goose.yml"
|
```yaml title="goose.yml"
|
||||||
|
|
||||||
name: Goose
|
|
||||||
|
|
||||||
on:
|
name: Goose
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened, labeled]
|
|
||||||
|
|
||||||
permissions:
|
on:
|
||||||
contents: write
|
pull_request:
|
||||||
pull-requests: write
|
types: [opened, synchronize, reopened, labeled]
|
||||||
issues: write
|
|
||||||
|
|
||||||
env:
|
permissions:
|
||||||
PROVIDER_API_KEY: ${{ secrets.REPLACE_WITH_PROVIDER_API_KEY }}
|
contents: write
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
pull-requests: write
|
||||||
|
issues: write
|
||||||
|
|
||||||
jobs:
|
env:
|
||||||
goose-comment:
|
PROVIDER_API_KEY: ${{ secrets.REPLACE_WITH_PROVIDER_API_KEY }}
|
||||||
runs-on: ubuntu-latest
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
steps:
|
jobs:
|
||||||
- name: Check out repository
|
goose-comment:
|
||||||
uses: actions/checkout@v4
|
name: Goose Comment
|
||||||
with:
|
runs-on: ubuntu-latest
|
||||||
fetch-depth: 0
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Gather PR information
|
- name: Gather PR information
|
||||||
run: |
|
run: |
|
||||||
{
|
{
|
||||||
echo "# Files Changed"
|
echo "# Files Changed"
|
||||||
gh pr view $PR_NUMBER --json files \
|
gh pr view $PR_NUMBER --json files \
|
||||||
-q '.files[] | "* " + .path + " (" + (.additions|tostring) + " additions, " + (.deletions|tostring) + " deletions)"'
|
-q '.files[] | "* " + .path + " (" + (.additions|tostring) + " additions, " + (.deletions|tostring) + " deletions)"'
|
||||||
echo ""
|
echo ""
|
||||||
echo "# Changes Summary"
|
echo "# Changes Summary"
|
||||||
gh pr diff $PR_NUMBER
|
gh pr diff $PR_NUMBER
|
||||||
} > changes.txt
|
} > changes.txt
|
||||||
|
|
||||||
- name: Install Goose CLI
|
- name: Install Goose CLI
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /home/runner/.local/bin
|
mkdir -p /home/runner/.local/bin
|
||||||
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh \
|
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh \
|
||||||
| CONFIGURE=false INSTALL_PATH=/home/runner/.local/bin bash
|
| CONFIGURE=false INSTALL_PATH=/home/runner/.local/bin bash
|
||||||
echo "/home/runner/.local/bin" >> $GITHUB_PATH
|
echo "/home/runner/.local/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Configure Goose
|
- name: Configure Goose
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.config/goose
|
mkdir -p ~/.config/goose
|
||||||
cat <<EOF > ~/.config/goose/config.yaml
|
cat <<EOF > ~/.config/goose/config.yaml
|
||||||
GOOSE_PROVIDER: REPLACE_WITH_PROVIDER
|
GOOSE_PROVIDER: REPLACE_WITH_PROVIDER
|
||||||
GOOSE_MODEL: REPLACE_WITH_MODEL
|
GOOSE_MODEL: REPLACE_WITH_MODEL
|
||||||
keyring: false
|
keyring: false
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Create instructions for Goose
|
- name: Create instructions for Goose
|
||||||
run: |
|
run: |
|
||||||
cat <<EOF > instructions.txt
|
cat <<EOF > instructions.txt
|
||||||
Create a summary of the changes provided. Don't provide any session or logging details.
|
Create a summary of the changes provided. Don't provide any session or logging details.
|
||||||
The summary for each file should be brief and structured as:
|
The summary for each file should be brief and structured as:
|
||||||
<filename/path (wrapped in backticks)>
|
<filename/path (wrapped in backticks)>
|
||||||
- dot points of changes
|
- dot points of changes
|
||||||
You don't need any extensions, don't mention extensions at all.
|
You don't need any extensions, don't mention extensions at all.
|
||||||
The changes to summarise are:
|
The changes to summarise are:
|
||||||
$(cat changes.txt)
|
$(cat changes.txt)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: cat instructions.txt
|
run: cat instructions.txt
|
||||||
|
|
||||||
- name: Run Goose and filter output
|
- name: Run Goose and filter output
|
||||||
run: |
|
run: |
|
||||||
goose run --instructions instructions.txt | \
|
goose run --instructions instructions.txt | \
|
||||||
# Remove ANSI color codes
|
# Remove ANSI color codes
|
||||||
sed -E 's/\x1B\[[0-9;]*[mK]//g' | \
|
sed -E 's/\x1B\[[0-9;]*[mK]//g' | \
|
||||||
# Remove session/logging lines
|
# Remove session/logging lines
|
||||||
grep -v "logging to /home/runner/.config/goose/sessions/" | \
|
grep -v "logging to /home/runner/.config/goose/sessions/" | \
|
||||||
grep -v "^starting session" | \
|
grep -v "^starting session" | \
|
||||||
grep -v "^Closing session" | \
|
grep -v "^Closing session" | \
|
||||||
# Trim trailing whitespace
|
# Trim trailing whitespace
|
||||||
sed 's/[[:space:]]*$//' \
|
sed 's/[[:space:]]*$//' \
|
||||||
> pr_comment.txt
|
> pr_comment.txt
|
||||||
|
|
||||||
|
- name: Post comment to PR
|
||||||
|
run: |
|
||||||
|
cat -A pr_comment.txt
|
||||||
|
gh pr comment $PR_NUMBER --body-file pr_comment.txt
|
||||||
|
|
||||||
- name: Post comment to PR
|
|
||||||
run: |
|
|
||||||
cat -A pr_comment.txt
|
|
||||||
gh pr comment $PR_NUMBER --body-file pr_comment.txt
|
|
||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user