Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
85 lines (81 loc) · 3.23 KB
/
Copy pathaction.yml
File metadata and controls
85 lines (81 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: 'CostGrep'
description: >-
GitHub Actions cost breakdown by who triggered the run: human vs AI agent
(Copilot, Claude, Codex, Cursor...) vs bot. List-price model, public
methodology, per-job evidence trail, runs on your runner — no data leaves
your infrastructure.
author: 'Paraphern'
inputs:
days:
description: 'Look-back window in days'
default: '30'
token:
description: 'GitHub token with actions:read (repo-scoped GITHUB_TOKEN is enough)'
default: '${{ github.token }}'
max-runs:
description: 'Safety cap on analyzed workflow runs'
default: '500'
config:
description: 'Optional JSON file {agents, bots, rates, coab} to extend/override defaults'
default: ''
pr-comment:
description: 'Optional: post the report as a PR comment (PR number, or "auto" to take it from GITHUB_REF; token needs pull-requests:write)'
default: ''
slack-webhook:
description: 'Optional: post the report to a Slack incoming webhook (https://hooks.slack.com/services/... URL)'
default: ''
json-file:
description: 'Where to write the full JSON report (relative to workspace)'
default: 'costgrep.json'
csv-file:
description: 'Optional: write per-job evidence CSV here (audit trail)'
default: ''
md-file:
description: 'Optional: write shareable Markdown report with provenance here'
default: ''
outputs:
total-cost:
description: 'Total list-price CI spend, USD'
total-minutes:
description: 'Total billable minutes (rounded per job, like GitHub)'
agent-cost:
description: 'List-price spend attributed to AI agents, USD'
agent-assisted-cost:
description: 'Spend from human-triggered runs whose commits carry an AI Co-Authored-By trailer, USD'
agent-share-pct:
description: 'Agents share of total CI spend, % (e.g. "6.8")'
agent-runs:
description: 'Workflow runs attributed to AI agents'
bot-runs:
description: 'Workflow runs attributed to bots'
bot-runs-pct:
description: 'Bot share of all runs, %'
runs:
using: 'composite'
steps:
- name: 'costgrep: human vs agent vs bot CI spend'
shell: bash
env:
# All user-controllable inputs go through env, never via ${{ }} inline in
# bash — script-injection hardening per GitHub's security guide.
CG_TOKEN: ${{ inputs.token }}
CG_REPO: ${{ github.repository }}
CG_DAYS: ${{ inputs.days }}
CG_MAX_RUNS: ${{ inputs.max-runs }}
CG_JSON: ${{ inputs.json-file }}
CG_CSV: ${{ inputs.csv-file }}
CG_MD: ${{ inputs.md-file }}
CG_CONFIG: ${{ inputs.config }}
CG_PR: ${{ inputs.pr-comment }}
CG_SLACK: ${{ inputs.slack-webhook }}
run: |
ARGS=(--repo "$CG_REPO" --days "$CG_DAYS" --max-runs "$CG_MAX_RUNS" --token "$CG_TOKEN" --json-file "$CG_JSON" --gh-output "$GITHUB_OUTPUT" --step-summary)
[ -n "$CG_CSV" ] && ARGS+=(--csv-file "$CG_CSV")
[ -n "$CG_MD" ] && ARGS+=(--md-file "$CG_MD")
[ -n "$CG_CONFIG" ] && ARGS+=(--config "$CG_CONFIG")
[ -n "$CG_PR" ] && ARGS+=("--pr-comment=$CG_PR")
[ -n "$CG_SLACK" ] && ARGS+=("--slack-webhook=$CG_SLACK")
node "${{ github.action_path }}/scripts/costgrep.mjs" "${ARGS[@]}"
branding:
icon: 'bar-chart-2'
color: 'purple'