Merge branch 'main' of https://github.com/AdzCoder/custom-instructions #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |