-
Notifications
You must be signed in to change notification settings - Fork 14
70 lines (58 loc) · 1.88 KB
/
generate-types.yml
File metadata and controls
70 lines (58 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Generate TypeScript Types
on:
push:
branches-ignore:
- production
- testing
paths:
- "lib/clusters/**/*.js"
- "scripts/generate-types.js"
- "index.js"
- "lib/constants.js"
workflow_dispatch:
jobs:
generate-types:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
registry-url: "https://npm.pkg.github.com"
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }}
- name: Generate TypeScript types
run: npm run generate-types
- name: Validate TypeScript types compile
run: npx tsc --noEmit index.d.ts
- name: Check for changes
id: check-changes
run: |
if git diff --quiet index.d.ts; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes to index.d.ts"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "index.d.ts has been updated"
git diff --stat index.d.ts
fi
- name: Commit and push changes
if: steps.check-changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add index.d.ts
git commit -m "chore(types): auto-generate TypeScript definitions
Updated by GitHub Actions after cluster changes.
[skip ci]"
git push origin HEAD:${{ github.ref_name }}