File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Update token count
2+
3+ on :
4+ push:aname : Update token count
5+
6+ on :
7+ push :
8+ paths :
9+ - ' instructions.txt'
10+ workflow_dispatch :
11+
12+ jobs :
13+ count :
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : write
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Count tokens
21+ run : |
22+ pip install tiktoken -q
23+ COUNT=$(python3 -c "
24+ import tiktoken
25+ enc = tiktoken.get_encoding('cl100k_base')
26+ print(len(enc.encode(open('instructions.txt').read())))
27+ ")
28+ sed -i "s/Tokens-~[0-9]*/Tokens-~$COUNT/" README.md
29+
30+ - name : Commit updated README
31+ run : |
32+ git config user.name "github-actions"
33+ git config user.email "actions@github.com"
34+ git diff --quiet || (git add README.md && git commit -m "Update token count" && git push)
35+
36+ paths :
37+ - " instructions.txt"
38+
39+ jobs :
40+ count :
41+ runs-on : ubuntu-latest
42+ permissions :
43+ contents : write
44+ steps :
45+ - uses : actions/checkout@v4
46+
47+ - name : Count tokens
48+ run : |
49+ pip install tiktoken -q
50+ COUNT=$(python3 -c "
51+ import tiktoken
52+ enc = tiktoken.get_encoding('cl100k_base')
53+ print(len(enc.encode(open('instructions.txt').read())))
54+ ")
55+ sed -i "s/Tokens-~[0-9]*/Tokens-~$COUNT/" README.md
56+
57+ - name : Commit updated README
58+ run : |
59+ git config user.name "github-actions"
60+ git config user.email "actions@github.com"
61+ git diff --quiet || (git add README.md && git commit -m "Update token count" && git push)
You can’t perform that action at this time.
0 commit comments