-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: add WPT updater for specific subsystems
- Loading branch information
Mert Can Altin
committed
Sep 21, 2024
1 parent
65768bc
commit efe6d9f
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: WPT update | ||
|
||
on: | ||
schedule: | ||
# Run once a week at 12:00 AM UTC on Sunday. | ||
- cron: 0 0 * * * | ||
workflow_dispatch: | ||
inputs: | ||
subsystems: | ||
description: Subsystem to run the update for | ||
required: false | ||
default: '["url"]' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
wpt-subsystem-update: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
subsystem: ${{ fromJSON(github.event.inputs.subsystems || '["url"]') }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Install node-core-utils | ||
run: | | ||
npm install -g node-core-utils | ||
- name: Update WPT for subsystem ${{ matrix.subsystem }} | ||
run: | | ||
git node wpt ${{ matrix.subsystem }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }} | ||
|
||
- name: Handle changes | ||
run: | | ||
if [[ "$(git status --porcelain)" != "" ]]; then | ||
git config --global user.name "${{ github.actor }}[bot]" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
git checkout -b actions/update-wpt-${{ matrix.subsystem }} | ||
git add . | ||
git commit -m "test: update WPT for ${{ matrix.subsystem }} to ${{ env.NEW_VERSION }}" | ||
gh auth setup-git | ||
git push origin actions/update-wpt-${{ matrix.subsystem }} -fu --no-verify | ||
echo "createPR=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "No changes to commit." | ||
fi | ||
env: | ||
GH_USER_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Open or update PR for the subsystem update | ||
if: steps.push-changes.outputs.createPR | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: actions/update-wpt-${{ matrix.subsystem }} | ||
title: 'test: update WPT for ${{ matrix.subsystem }} to ${{ env.NEW_VERSION }}' | ||
body: | | ||
This is an automated update of the WPT for ${{ matrix.subsystem }} to ${{ env.NEW_VERSION }}. |