Registry check #9
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: Registry check | |
| on: | |
| schedule: | |
| - cron: '0 12 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org/' | |
| - run: npm ci | |
| - run: npm run build -w @tokenometer/core | |
| - id: check | |
| run: | | |
| set +e | |
| OUTPUT=$(npm run --silent check:overrides -w @tokenometer/core 2>&1) | |
| STATUS=$? | |
| { | |
| echo 'output<<EOF' | |
| echo "$OUTPUT" | |
| echo 'EOF' | |
| } >> "$GITHUB_OUTPUT" | |
| echo "status=$STATUS" >> "$GITHUB_OUTPUT" | |
| echo "$OUTPUT" | |
| exit 0 | |
| - name: Open or update tracking issue on findings | |
| if: steps.check.outputs.status != '0' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BODY: | | |
| The weekly tokenlens registry check found findings. | |
| ``` | |
| ${{ steps.check.outputs.output }} | |
| ``` | |
| Resolve by either: | |
| - Deleting the listed `LOCAL_OVERRIDES` entries in `packages/core/src/rates.ts`, or | |
| - Reviewing upstream pricing/context drift and refreshing the snapshot via | |
| `npm run snapshot:registry -w @tokenometer/core`. | |
| run: | | |
| TITLE='[registry-check] tokenlens upstream changes detected' | |
| EXISTING=$(gh issue list --search "$TITLE in:title is:open" --json number --jq '.[0].number') | |
| if [ -n "$EXISTING" ]; then | |
| gh issue comment "$EXISTING" --body "$BODY" | |
| else | |
| gh issue create --title "$TITLE" --body "$BODY" --label registry-check | |
| fi | |
| - name: Fail job if findings present | |
| if: steps.check.outputs.status != '0' | |
| run: exit 1 |