Skip to content

Update WebdriverBiDi types #615

Update WebdriverBiDi types

Update WebdriverBiDi types #615

# 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