File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Update token count
22
3- on :
4- push:aname : Update token count
5-
63on :
74 push :
85 paths :
96 - ' instructions.txt'
107 workflow_dispatch :
118
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-
399jobs :
4010 count :
4111 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments