Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add WPT updater for specific subsystems #54460

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/update-wpt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: WPT update

on:
schedule:
# Run once a week at 12:00 AM UTC on Sunday.
- cron: 0 0 * * *
mertcanaltin marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:
inputs:
subsystems:
description: Subsystem to run the update for
required: false
default: '["url"]'

permissions:
contents: read

env:
NODE_VERSION: lts/*

jobs:
wpt-subsystem-update:
mertcanaltin marked this conversation as resolved.
Show resolved Hide resolved
if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
strategy:
mertcanaltin marked this conversation as resolved.
Show resolved Hide resolved
fail-fast: false
matrix:
subsystem: ${{ fromJSON(github.event.inputs.subsystems || '["url"]') }}

steps:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7
with:
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install @node-core/utils
run: npm install -g @node-core/utils

- name: Setup @node-core/utils
run: |
ncu-config set username "$USERNAME"
ncu-config set token "$GH_TOKEN"
ncu-config set jenkins_token "$JENKINS_TOKEN"
ncu-config set owner "${{ github.repository_owner }}"
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)"
env:
USERNAME: ${{ secrets.JENKINS_USER }}
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}

- name: Update WPT for subsystem ${{ matrix.subsystem }}
run: |
git node wpt ${{ matrix.subsystem }}
panva marked this conversation as resolved.
Show resolved Hide resolved

- name: Calculate new version for WPT using jq
run: |
new_version=$(jq -r '.${{ matrix.subsystem }}.commit' test/fixtures/wpt/versions.json)
echo "new_version=$new_version" >> $GITHUB_ENV

- name: Open or update PR for the subsystem update
uses: gr2m/create-or-update-pull-request-action@86ec1766034c8173518f61d2075cc2a173fb8c97
with:
branch: actions/update-wpt-${{ matrix.subsystem }}
author: Node.js GitHub Bot <[email protected]>
title: 'test: update WPT for ${{ matrix.subsystem }} to ${{ env.new_version }}'
commit-message: 'test: update WPT for ${{ matrix.subsystem }} to ${{ env.new_version }}'
labels: test
update-pull-request-title-and-body: true
body: |
This is an automated update of the WPT for ${{ matrix.subsystem }} to ${{ env.new_version }}.
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}