Skip to content

Commit 58f3349

Browse files
committed
🏗️ Upgrade workflows and enable erasableSyntaxOnly
1 parent 24c6432 commit 58f3349

9 files changed

+126
-75
lines changed

.github/authorized_keys

-1
This file was deleted.

.github/workflows/github-pages.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
version: latest
1616
- uses: actions/setup-node@v4
1717
with:
18-
node-version: 21
18+
node-version: 23
1919
cache: pnpm
2020
- run: pnpm install --frozen-lockfile
2121
- run: pnpm run docs

.github/workflows/node.js.yaml

+69-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
name: Node.js CI
22

33
on:
4-
push:
5-
branches: main
4+
merge_group:
5+
branches:
6+
- main
67
pull_request:
7-
branches: main
8+
branches:
9+
- main
10+
push:
11+
branches:
12+
- main
813

914
jobs:
1015
test:
@@ -17,9 +22,68 @@ jobs:
1722
version: latest
1823
- uses: actions/setup-node@v4
1924
with:
20-
node-version: 21
25+
node-version: 23
2126
cache: pnpm
22-
- run: pnpm install --frozen-lockfile
27+
- run: pnpm install --frozen-lockfile --strict-peer-dependencies
2328
- run: pnpm run build --noEmit
2429
- run: pnpm run lint
2530
- run: pnpm run test
31+
32+
fix:
33+
runs-on: ubuntu-latest
34+
35+
permissions:
36+
contents: write
37+
38+
if: failure() && github.event_name != 'merge_group' && github.actor != 'github-actions[bot]' && github.actor != 'nektos/act'
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
ref: ${{ github.ref }}
44+
- uses: pnpm/action-setup@v4
45+
with:
46+
version: latest
47+
- uses: actions/setup-node@v4
48+
with:
49+
cache: pnpm
50+
node-version: 23
51+
52+
- run: |
53+
pnpm install --fix-lockfile --no-frozen-lockfile
54+
git add .
55+
- id: commit-lockfile
56+
uses: qoomon/actions--create-commit@v1
57+
with:
58+
message: |
59+
📌 pnpm install --fix-lockfile
60+
61+
[dependabot skip]
62+
skip-empty: true
63+
64+
- run: |
65+
pnpm run format
66+
git add .
67+
- id: commit-format
68+
uses: qoomon/actions--create-commit@v1
69+
with:
70+
message: |
71+
🎨 pnpm run format
72+
73+
[dependabot skip]
74+
skip-empty: true
75+
76+
- run: |
77+
pnpm run lint:fix
78+
git add .
79+
- id: commit-lint
80+
uses: qoomon/actions--create-commit@v1
81+
with:
82+
message: |
83+
🚨 pnpm run lint:fix
84+
85+
[dependabot skip]
86+
skip-empty: true
87+
88+
- if: steps.commit-lockfile.outputs.commit || steps.commit-format.outputs.commit || steps.commit-lint.outputs.commit
89+
run: git push

.github/workflows/pnpm-publish.yaml

+2-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/setup-node@v4
2323
with:
2424
cache: pnpm
25-
node-version: 21
25+
node-version: 23
2626
- run: pnpm install
2727
- run: pnpm build
2828

@@ -43,13 +43,6 @@ jobs:
4343
NODE_AUTH_TOKEN: ${{ secrets.CODERABBIT_NPMTOKEN }}
4444

4545
- run: pnpm pack --pack-gzip-level 9
46-
- name: Sign
47-
run: |
48-
eval `ssh-agent -s`
49-
ssh-add - <<< '${{ secrets.DEPLOY_KEY_PRIVATE }}'
50-
echo '${{ vars.DEPLOY_KEY_PUBLIC }}' > '${{ runner.temp }}/DEPLOY_KEY_PUBLIC.pub'
51-
ssh-keygen -Y sign -f '${{ runner.temp }}/DEPLOY_KEY_PUBLIC.pub' -n file coderabbitai-openai-chat-tokens-*.tgz
52-
ssh-keygen -Y verify -f ./.github/authorized_keys -I '41898282+github-actions[bot]@users.noreply.github.com' -n file -s coderabbitai-openai-chat-tokens-*.tgz.sig < coderabbitai-openai-chat-tokens-*.tgz
53-
- run: gh release upload ${{ github.ref_name }} coderabbitai-openai-chat-tokens-*.tgz coderabbitai-openai-chat-tokens-*.tgz.sig
46+
- run: gh release upload ${{ github.ref_name }} coderabbitai-openai-chat-tokens-*.tgz
5447
env:
5548
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pnpm-version-patch.yaml

+14-20
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,29 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
15-
ssh-key: ${{ secrets.DEPLOY_KEY_PRIVATE }}
15+
ref: ${{ github.ref }}
1616
- uses: pnpm/action-setup@v4
1717
with:
1818
version: latest
1919
- uses: actions/setup-node@v4
2020
with:
2121
cache: pnpm
22-
node-version: 21
23-
- name: Configure Git, patch, release and push
24-
run: |
25-
git config user.name 'github-actions[bot]'
26-
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
27-
28-
git config commit.gpgsign true
29-
git config gpg.format ssh
30-
git config push.gpgSign 'if-asked'
31-
git config tag.gpgSign true
32-
git config user.signingkey 'key::${{ vars.DEPLOY_KEY_PUBLIC }}'
22+
node-version: 23
3323

34-
eval `ssh-agent -s`
35-
ssh-add - <<< '${{ secrets.DEPLOY_KEY_PRIVATE }}'
24+
- id: patch
25+
run: |
26+
echo "VERSION=$(pnpm version patch --no-git-tag-version)" >> "$GITHUB_OUTPUT"
27+
git add .
3628
37-
VERSION=$(pnpm version patch --no-git-tag-version)
29+
- id: commit
30+
uses: qoomon/actions--create-commit@v1
31+
with:
32+
message: 🔖 ${{ steps.patch.outputs.VERSION }}
3833

39-
git commit --all --message "🔖 $VERSION"
40-
git tag --annotate --message "🔖 $VERSION" --sign $VERSION
34+
- run: |
4135
git push
42-
git push --tags
43-
44-
gh release create $VERSION --generate-notes --title $VERSION --verify-tag
36+
gh release create "$VERSION" --generate-notes --target "$COMMIT" --title "$VERSION"
4537
env:
38+
COMMIT: ${{ steps.commit.outputs.commit }}
4639
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
VERSION: ${{ steps.patch.outputs.VERSION }}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This library handles both of those cases, as well as a minor adjustment needed f
1515
## Usage
1616

1717
```typescript
18-
import { promptTokensEstimate } from "openai-chat-tokens"
18+
import { promptTokensEstimate } from "@coderabbitai/openai-chat-tokens"
1919

2020
const estimate = promptTokensEstimate({
2121
messages: [

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"format": "prettier --write .",
2121
"lint": "eslint . && prettier --check .",
2222
"lint:fix": "eslint --fix .; prettier --list-different --write .",
23-
"test": "vitest",
24-
"test:watch": "vitest --watch"
23+
"test": "vitest run",
24+
"test:watch": "vitest"
2525
},
2626
"devDependencies": {
2727
"@eslint/js": "^9.9.1",
@@ -30,7 +30,7 @@
3030
"openai": "^4.56.0",
3131
"prettier": "^3.3.3",
3232
"typedoc": "^0.26.6",
33-
"typescript": "5.7.3",
33+
"typescript": "5.8.0-beta",
3434
"typescript-eslint": "^8.2.0",
3535
"vite": "^6.0.7",
3636
"vitest": "^3.0.5"

pnpm-lock.yaml

+35-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"isolatedModules": true,
3434
"verbatimModuleSyntax": true,
3535
"isolatedDeclarations": true,
36+
"erasableSyntaxOnly": true,
3637
"forceConsistentCasingInFileNames": true,
3738

3839
/* Type Checking */

0 commit comments

Comments
 (0)