Skip to content

Merge branch 'main' of https://github.com/AdzCoder/custom-instructions #7

Merge branch 'main' of https://github.com/AdzCoder/custom-instructions

Merge branch 'main' of https://github.com/AdzCoder/custom-instructions #7

Workflow file for this run

name: Update token count
on:
push:
paths:
- "instructions.txt"
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
count:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Count tokens
run: |
pip install tiktoken -q
COUNT=$(python3 -c "
import tiktoken
enc = tiktoken.get_encoding('cl100k_base')
print(len(enc.encode(open('instructions.txt').read())))
")
sed -i "s/Tokens-~[0-9]*/Tokens-~$COUNT/" README.md
- name: Commit updated README
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git diff --quiet || (git add README.md && git commit -m "Update token count" && git push)