Skip to content

Commit 0653408

Browse files
chore: Move Permissions CDDL update to a dedicated action
Until Permissions fix is merged w3c/permissions#464, move the task to a dedicated action
1 parent f74d512 commit 0653408

File tree

2 files changed

+99
-22
lines changed

2 files changed

+99
-22
lines changed

.github/workflows/update-bidi-types.yml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,7 @@ jobs:
3333
repository: ${{ github.event.inputs.repository || 'w3c/webdriver-bidi' }}
3434
ref: ${{ github.event.inputs.source_ref || 'main' }}
3535
path: webdriver-bidi
36-
- name: Check out w3c/permissions spec repository
37-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38-
with:
39-
repository: w3c/permissions
40-
ref: main
41-
path: permissions
42-
- name: Check out w3c/permissions spec repository
36+
- name: Check out WebBluetoothCG/web-bluetooth spec repository
4337
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4438
with:
4539
repository: WebBluetoothCG/web-bluetooth
@@ -53,18 +47,10 @@ jobs:
5347
with:
5448
name: all-cddl
5549
path: webdriver-bidi/all.cddl
56-
- name: Generate WebDriverBidi CDDL for Permissions
57-
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.html && mv all.cddl permissions.cddl
58-
working-directory: permissions
59-
- name: Upload WebDriverBidi CDDL for Permissions
60-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
61-
with:
62-
name: permissions-cddl
63-
path: permissions/permissions.cddl
6450
- name: Generate WebDriverBidi CDDL for web-bluetooth
6551
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.bs && mv all.cddl web-bluetooth.cddl
6652
working-directory: web-bluetooth
67-
- name: Upload WebDriverBidi CDDL for Permissions
53+
- name: Upload WebDriverBidi CDDL for web-bluetooth
6854
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6955
with:
7056
name: web-bluetooth-cddl
@@ -100,18 +86,12 @@ jobs:
10086
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
10187
with:
10288
name: all-cddl
103-
- name: Download WebDriverBidi CDDL for Permissions
104-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
105-
with:
106-
name: permissions-cddl
10789
- name: Download WebDriverBidi CDDL for web-bluetooth
10890
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
10991
with:
11092
name: web-bluetooth-cddl
11193
- name: Generate TypeScript types for the main spec
11294
run: node tools/generate-bidi-types.mjs --cddl-file all.cddl
113-
- name: Generate TypeScript types for Permissions spec
114-
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
11595
- name: Generate TypeScript types for web-bluetooth spec
11696
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
11797
- run: git diff
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# This workflow will update the WebdriverBiDi types.
2+
# TODO: move to update-bidi-types after Permissions CDDL build is fixed:
3+
# https://github.com/w3c/permissions/pull/464
4+
5+
name: Update Permissions WebdriverBiDi types
6+
7+
# Declare default permissions as read only.
8+
permissions: read-all
9+
10+
on:
11+
schedule:
12+
# Run daily at 10AM.
13+
- cron: '0 10 * * *'
14+
workflow_dispatch:
15+
inputs:
16+
source_ref:
17+
description: Ref in spec repo to update from. Default is `main`.
18+
default: main
19+
required: false
20+
type: string
21+
repository:
22+
description: Repository with the spec to update from. Default is `w3c/webdriver-bidi`.
23+
default: w3c/webdriver-bidi
24+
required: false
25+
type: string
26+
27+
jobs:
28+
build:
29+
name: Build Permissions CDDL
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check out w3c/permissions spec repository
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
with:
35+
repository: w3c/permissions
36+
ref: main
37+
path: permissions
38+
- name: Generate WebDriverBidi CDDL for Permissions
39+
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.html && mv all.cddl permissions.cddl
40+
working-directory: permissions
41+
- name: Upload WebDriverBidi CDDL for Permissions
42+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
43+
with:
44+
name: permissions-cddl
45+
path: permissions/permissions.cddl
46+
47+
pr:
48+
name: Send PR
49+
needs: build
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Check out mapper repository
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
- name: Set up Python
55+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
56+
with:
57+
python-version: '3.11'
58+
cache: pip
59+
- name: Setup Go
60+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.0.0
61+
with:
62+
go-version: '1.21.x'
63+
- name: Install cddlconv
64+
run: cargo install [email protected]
65+
- name: Set up Node.js
66+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
67+
with:
68+
node-version-file: '.nvmrc'
69+
cache: npm
70+
- uses: google/wireit@f21db1f3a6a4db31f42787a958cf2a18308effed # setup-github-actions-caching/v2.0.3
71+
- name: Install and build npm dependencies
72+
run: npm ci
73+
- name: Download WebDriverBidi CDDL for Permissions
74+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
75+
with:
76+
name: permissions-cddl
77+
- name: Generate TypeScript types for Permissions spec
78+
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
79+
- run: git diff
80+
# Needed for `npm run format`.
81+
- run: python -m pip install pre-commit
82+
- run: python -m pip freeze --local
83+
- name: Run formatter
84+
run: npm run format || npm run format
85+
continue-on-error: true
86+
- name: Create Pull Request
87+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
88+
with:
89+
token: ${{ secrets.BROWSER_AUTOMATION_BOT_TOKEN }}
90+
branch: browser-automation-bot/update-bidi-types
91+
delete-branch: true
92+
committer: Browser Automation Bot <[email protected]>
93+
author: Browser Automation Bot <[email protected]>
94+
commit-message: 'build(spec): update Permissions WebDriverBiDi types'
95+
title: 'build(spec): update Permissions WebDriverBiDi types'
96+
body: Automatically generated by https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/.github/workflows/update-bidi-types.yml
97+
push-to-fork: browser-automation-bot/chromium-bidi

0 commit comments

Comments
 (0)