-
Notifications
You must be signed in to change notification settings - Fork 32
135 lines (130 loc) · 5.81 KB
/
update-bidi-types.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# This workflow will update the WebdriverBiDi types.
name: Update WebdriverBiDi types
# Declare default permissions as read only.
permissions: read-all
on:
schedule:
# Run daily at 10AM.
- cron: '0 10 * * *'
workflow_dispatch:
inputs:
source_ref:
description: Ref in spec repo to update from. Default is `main`.
default: main
required: false
type: string
repository:
description: Repository with the spec to update from. Default is `w3c/webdriver-bidi`.
default: w3c/webdriver-bidi
required: false
type: string
jobs:
build:
name: Build WebDriverBiDi types
runs-on: ubuntu-latest
steps:
- name: Check out the main spec repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ github.event.inputs.repository || 'w3c/webdriver-bidi' }}
ref: ${{ github.event.inputs.source_ref || 'main' }}
path: webdriver-bidi
- name: Check out w3c/permissions spec repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: w3c/permissions
ref: main
path: permissions
- name: Check out w3c/permissions spec repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: WebBluetoothCG/web-bluetooth
ref: main
path: web-bluetooth
- name: Generate WebDriverBidi CDDL
run: ./scripts/test.sh
working-directory: webdriver-bidi
- name: Upload WebDriverBidi CDDL
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: all-cddl
path: webdriver-bidi/all.cddl
- name: Generate WebDriverBidi CDDL for Permissions
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.html && mv all.cddl permissions.cddl
working-directory: permissions
- name: Upload WebDriverBidi CDDL for Permissions
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: permissions-cddl
path: permissions/permissions.cddl
- name: Generate WebDriverBidi CDDL for web-bluetooth
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.bs && mv all.cddl web-bluetooth.cddl
working-directory: web-bluetooth
- name: Upload WebDriverBidi CDDL for Permissions
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: web-bluetooth-cddl
path: web-bluetooth/web-bluetooth.cddl
pr:
name: Send PR
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out mapper repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
cache: pip
- name: Setup Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.0.0
with:
go-version: '1.21.x'
- name: Install cddlconv
run: cargo install cddlconv@0.1.5
- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: '.nvmrc'
cache: npm
- uses: google/wireit@83d7f8bed70b7bcfc40f4b9f54f4b7485753991b # setup-github-actions-caching/v2.0.1
- name: Install and build npm dependencies
run: npm ci
- name: Download WebDriverBidi CDDL
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: all-cddl
- name: Download WebDriverBidi CDDL for Permissions
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: permissions-cddl
- name: Download WebDriverBidi CDDL for web-bluetooth
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: web-bluetooth-cddl
- name: Generate TypeScript types for the main spec
run: node tools/generate-bidi-types.mjs --cddl-file all.cddl
- name: Generate TypeScript types for Permissions spec
run: node tools/generate-bidi-types.mjs --cddl-file permissions.cddl --ts-file src/protocol/generated/webdriver-bidi-permissions.ts --zod-file src/protocol-parser/generated/webdriver-bidi-permissions.ts
- name: Generate TypeScript types for web-bluetooth spec
run: node tools/generate-bidi-types.mjs --cddl-file web-bluetooth.cddl --ts-file src/protocol/generated/webdriver-bidi-bluetooth.ts --zod-file src/protocol-parser/generated/webdriver-bidi-bluetooth.ts
- run: git diff
# Needed for `npm run format`.
- run: python -m pip install pre-commit
- run: python -m pip freeze --local
- name: Run formatter
run: npm run format || npm run format
continue-on-error: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }}
branch: browser-automation-bot/update-bidi-types
delete-branch: true
committer: Browser Automation Bot <browser-automation-bot@google.com>
author: Browser Automation Bot <browser-automation-bot@google.com>
commit-message: 'build(spec): update WebDriverBiDi types'
title: 'build(spec): update WebDriverBiDi types'
body: Automatically generated by https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/.github/workflows/update-bidi-types.yml
push-to-fork: browser-automation-bot/chromium-bidi