Skip to content

Commit

Permalink
tools: add WPT updater for url subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
Mert Can Altin committed Sep 18, 2024
1 parent 65768bc commit eb7eca5
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/update-wpt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: WPT update

on:
schedule:
# Run once a week at 12:00 AM UTC on Sunday.
- cron: 0 0 * * *
workflow_dispatch:

permissions:
contents: read

jobs:
wpt-subsystem-update:
runs-on: ubuntu-latest
strategy:
matrix:
subsystem:
- url

steps:
- uses: actions/checkout@v4@<hash>
with:
persist-credentials: false

- name: Update WPT for subsystem ${{ matrix.subsystem }}
run: |
git node wpt update --subsystem=${{ matrix.subsystem }}
env:
GH_USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run WPT tests
run: |
git node wpt run --subsystem=${{ matrix.subsystem }}
env:
GH_USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Handle test failures and success
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 a PR for the subsystem update
if: steps.push-changes.outputs.createPR
continue-on-error: true
run: |
gh pr create --head 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 }}."
env:
GH_USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit eb7eca5

Please sign in to comment.