-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: api-check | ||
run-name: ${{ github.actor }}'s api check | ||
on: [pull_request] | ||
jobs: | ||
api-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.17.0' | ||
|
||
- run: npm ci | ||
|
||
- name: Copy old public.d.ts | ||
run: mv ./.api/public.d.ts ./.api/public_old.d.ts | ||
|
||
- run: npm run api | ||
|
||
- name: Compare api | ||
run: node ./.github/workflows/scripts/api-check.js |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const fs = require('fs'); | ||
const ps = require('path'); | ||
const chalk = require('chalk'); | ||
|
||
const oldVer = ps.join(__dirname, '../../../.api/public_old.d.ts'); | ||
const newVer = ps.join(__dirname, '../../../.api/public.d.ts'); | ||
const oldContent = fs.readFileSync(oldVer, 'utf8'); | ||
const newContent = fs.readFileSync(newVer, 'utf8'); | ||
|
||
if (oldContent !== newContent) { | ||
console.error(chalk.red(`please run 'npm run api' to update public.d.ts, and commit this file.`)); | ||
process.exit(1); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: test | ||
run-name: ${{ github.actor }}'s test | ||
on: [pull_request] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.17.0' | ||
|
||
- run: npm ci | ||
|
||
- run: npm test |