-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-action-template.yml
More file actions
54 lines (44 loc) · 1.74 KB
/
github-action-template.yml
File metadata and controls
54 lines (44 loc) · 1.74 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
# Drop this file into your repo at .github/workflows/ccmeter-pr-cost.yml
# It posts the Claude Code spend for a PR (since the branch was created)
# back as a sticky comment. Useful for tracking how much "vibe-coding" each PR
# actually cost in Claude Code time.
#
# Prereq: each contributor needs to run `ccmeter export --format json --out
# .ccmeter-export.json` locally and commit it on the branch (or your CI bot
# can mount the contributor's ~/.claude/projects). Treat the export as a
# build artifact, not a source-of-truth — the file is JSON, no secrets.
name: Claude Code spend
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
pr-cost:
if: ${{ hashFiles('.ccmeter-export.json') != '' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install ccmeter
run: npm i -g ccmeter
- name: Generate stat-card from committed export
id: card
run: |
# Ingest the contributor's export and produce a Markdown card.
ccmeter merge .ccmeter-export.json --out .ccmeter-merged.json
ccmeter share --days 30 --fuzzy --out card.md
echo "card<<EOF" >> "$GITHUB_OUTPUT"
cat card.md >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Sticky PR comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: ccmeter
message: |
### Claude Code spend on this branch
${{ steps.card.outputs.card }}
<sub>Generated by [ccmeter](https://github.com/vnmoorthy/ccmeter). No source code or prompts leave the runner.</sub>