diff --git a/.github/workflows/test-finder.yml b/.github/workflows/test-finder.yml index d2c13e41ccac..7b4133bcb411 100644 --- a/.github/workflows/test-finder.yml +++ b/.github/workflows/test-finder.yml @@ -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 + goose run -i /tmp/create_working_test.txt --with-builtin developer --path /tmp/goose-home/.local/share/goose/sessions/test_generation.jsonl # Check the result if [ -f /tmp/test_result.txt ]; then @@ -101,6 +101,20 @@ jobs: echo "No result file created" fi + - 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}" + fi + - name: Create Pull Request if: steps.find_untested.outputs.patch_created == 'true' && github.event.inputs.dry_run != 'true' uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # pin@v7.0.8 @@ -125,6 +139,11 @@ jobs: - [ ] Test passes locally - [ ] 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 }} + --- *Generated by the Daily Test Coverage Finder workflow* branch: goose/test-coverage-${{ github.run_number }}