Skip to content
Merged
Show file tree
Hide file tree
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
42 changes: 1 addition & 41 deletions .github/workflows/cli-skill-review-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,47 +167,7 @@ jobs:
COMMAND: ${{ inputs.command }}
run: |
set -euo pipefail

python3 - << 'PY'
import os
from pathlib import Path

marker = os.environ.get('MARKER', '<!-- cli-skill-report -->')
command = os.environ.get('COMMAND', '/cli-review')
success = os.environ.get('PI_SUCCESS', '')
cost = os.environ.get('PI_COST', '')
duration = os.environ.get('PI_DURATION', '')
input_tokens = os.environ.get('PI_INPUT_TOKENS', '')
output_tokens = os.environ.get('PI_OUTPUT_TOKENS', '')
run_url = os.environ.get('RUN_URL', '')
response = os.environ.get('PI_RESPONSE', '')

if not response.strip():
response = '_No response was returned by Pi._'

# Keep body safely below GitHub comment max size.
max_response_len = 50000
if len(response) > max_response_len:
response = response[:max_response_len] + "\n\n... _truncated_"

body = f"""{marker}
## CLI Skill Report ({command})

| Metric | Value |
|---|---|
| Success | {success or 'unknown'} |
| Duration (s) | {duration or 'n/a'} |
| Cost (USD) | {cost or 'n/a'} |
| Tokens (in/out) | {input_tokens or 'n/a'} / {output_tokens or 'n/a'} |
| Workflow run | [view run]({run_url}) |

{response}
"""

p = Path('pi-report-comment.md')
p.write_text(body.strip() + "\n", encoding='utf-8')
print(f"Wrote {p}")
PY
python3 scripts/build-pr-report.py

- name: Fail when agent run is unsuccessful
if: ${{ steps.cli_scope.outputs.proceed == 'true' && inputs.fail_on_agent_error && steps.pi.outputs.success != 'true' }}
Expand Down
45 changes: 45 additions & 0 deletions scripts/build-pr-report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3
import os
from pathlib import Path


def main() -> None:
marker = os.environ.get("MARKER", "<!-- cli-skill-report -->")
command = os.environ.get("COMMAND", "/cli-review")
success = os.environ.get("PI_SUCCESS", "")
cost = os.environ.get("PI_COST", "")
duration = os.environ.get("PI_DURATION", "")
input_tokens = os.environ.get("PI_INPUT_TOKENS", "")
output_tokens = os.environ.get("PI_OUTPUT_TOKENS", "")
run_url = os.environ.get("RUN_URL", "")
response = os.environ.get("PI_RESPONSE", "")

if not response.strip():
response = "_No response was returned by Pi._"

# Keep body safely below GitHub comment max size.
max_response_len = 50000
if len(response) > max_response_len:
response = response[:max_response_len] + "\n\n... _truncated_"

body = f"""{marker}
## CLI Skill Report ({command})

| Metric | Value |
|---|---|
| Success | {success or 'unknown'} |
| Duration (s) | {duration or 'n/a'} |
| Cost (USD) | {cost or 'n/a'} |
| Tokens (in/out) | {input_tokens or 'n/a'} / {output_tokens or 'n/a'} |
| Workflow run | [view run]({run_url}) |

{response}
"""

report_path = Path("pi-report-comment.md")
report_path.write_text(body.strip() + "\n", encoding="utf-8")
print(f"Wrote {report_path}")


if __name__ == "__main__":
main()
Loading