Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions .github/workflows/test-finder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- Include a descriptive test name that explains what is being tested
EOF

goose run -i /tmp/create_working_test.txt --with-builtin developer --path /tmp/goose-home/.local/share/goose/sessions/test_generation.jsonl
goose run -i /tmp/create_working_test.txt --with-builtin developer

# Check the result
if [ -f /tmp/test_result.txt ]; then
Expand All @@ -104,15 +104,29 @@ jobs:
- name: Extract token metrics
id: metrics
run: |
SESSION_FILE="/tmp/goose-home/.local/share/goose/sessions/test_generation.jsonl"
if [ -f "$SESSION_FILE" ]; then
TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.accumulated_total_tokens // 0')
INPUT_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.accumulated_input_tokens // 0')
OUTPUT_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.accumulated_output_tokens // 0')
echo "total_tokens=${TOKENS}" >> $GITHUB_OUTPUT
echo "input_tokens=${INPUT_TOKENS}" >> $GITHUB_OUTPUT
echo "output_tokens=${OUTPUT_TOKENS}" >> $GITHUB_OUTPUT
echo "Token usage - Total: ${TOKENS}, Input: ${INPUT_TOKENS}, Output: ${OUTPUT_TOKENS}"
# Find the most recently created session file in the goose sessions directory
SESSION_DIR="$HOME/.local/share/goose/sessions"
if [ -d "$SESSION_DIR" ]; then
SESSION_FILE=$(ls -t "$SESSION_DIR"/*.jsonl 2>/dev/null | head -1)
if [ -f "$SESSION_FILE" ]; then
echo "Found session file: $SESSION_FILE"
# Current context size metrics
TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.total_tokens // 0')
INPUT_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.input_tokens // 0')
OUTPUT_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.output_tokens // 0')
echo "total_tokens=${TOKENS}" >> $GITHUB_OUTPUT
echo "input_tokens=${INPUT_TOKENS}" >> $GITHUB_OUTPUT
echo "output_tokens=${OUTPUT_TOKENS}" >> $GITHUB_OUTPUT
# Accumulated API usage metrics
ACC_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.accumulated_total_tokens // 0')
ACC_INPUT_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.accumulated_input_tokens // 0')
ACC_OUTPUT_TOKENS=$(head -1 "$SESSION_FILE" | jq -r '.accumulated_output_tokens // 0')
echo "accumulated_total_tokens=${ACC_TOKENS}" >> $GITHUB_OUTPUT
echo "accumulated_input_tokens=${ACC_INPUT_TOKENS}" >> $GITHUB_OUTPUT
echo "accumulated_output_tokens=${ACC_OUTPUT_TOKENS}" >> $GITHUB_OUTPUT
echo "Token usage - Total: ${TOKENS}, Input: ${INPUT_TOKENS}, Output: ${OUTPUT_TOKENS}"
echo "Accumulated usage - Total: ${ACC_TOKENS}, Input: ${ACC_INPUT_TOKENS}, Output: ${ACC_OUTPUT_TOKENS}"
fi
fi

- name: Create Pull Request
Expand Down Expand Up @@ -140,9 +154,14 @@ jobs:
- [ ] No unnecessary changes included

### Metrics
- **Total tokens used**: ${{ steps.metrics.outputs.total_tokens }}
- **Input tokens**: ${{ steps.metrics.outputs.input_tokens }}
- **Output tokens**: ${{ steps.metrics.outputs.output_tokens }}
#### Current Context Size
- **Total**: ${{ steps.metrics.outputs.total_tokens }} tokens
- **Input**: ${{ steps.metrics.outputs.input_tokens }} tokens
- **Output**: ${{ steps.metrics.outputs.output_tokens }} tokens
#### API Usage (Billable)
- **Total**: ${{ steps.metrics.outputs.accumulated_total_tokens }} tokens
- **Input**: ${{ steps.metrics.outputs.accumulated_input_tokens }} tokens
- **Output**: ${{ steps.metrics.outputs.accumulated_output_tokens }} tokens

---
*Generated by the Daily Test Coverage Finder workflow*
Expand All @@ -164,4 +183,4 @@ jobs:
echo "📝 Function tested: $FUNCTION_NAME"
else
echo "ℹ️ No suitable untested code found today"
fi
fi
Loading