|
| 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