Roll Next #20
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
name: Roll Next | |
on: | |
workflow_dispatch: | |
schedule: | |
# Every day at 10:05 UTC | |
- cron: "5 10 * * *" | |
permissions: | |
contents: write | |
jobs: | |
roll-docs: | |
name: Roll Playwright to ToT | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'microsoft/playwright' | |
path: playwright | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Roll | |
run: npm run roll | |
env: | |
SRC_DIR: ./playwright | |
- name: Prepare branch | |
id: prepare-branch | |
run: | | |
BRANCH_NAME="roll/next-$(date +"%d-%m-%y")" | |
set +e | |
git diff -s --exit-code | |
HAS_CHANGES="$?" | |
set -e | |
GIT_COMMIT="$(cd playwright && git rev-parse HEAD && cd ..)" | |
echo "HAS_CHANGES=$HAS_CHANGES" >> $GITHUB_OUTPUT | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
echo "GIT_COMMIT=$GIT_COMMIT" >> $GITHUB_OUTPUT | |
if [[ $HAS_CHANGES == 0 ]]; then | |
echo "No changes detected, skipping PR" | |
exit 0 | |
fi | |
git config --global user.name github-actions | |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git checkout -b "$BRANCH_NAME" | |
git add . | |
git commit -m "feat(roll): roll to ToT Playwright ($(date +"%d-%m-%y"))" | |
git push origin $BRANCH_NAME --force | |
- name: Create Pull Request | |
uses: actions/github-script@v7 | |
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }} | |
with: | |
github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }} | |
script: | | |
await github.rest.pulls.create({ | |
owner: 'microsoft', | |
repo: 'playwright.dev', | |
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}', | |
base: 'main', | |
title: 'feat(roll): roll to ToT Playwright (${{ steps.prepare-branch.outputs.BRANCH_NAME }})', | |
body: 'Upstream commit: https://github.com/microsoft/playwright/commit/${{ steps.prepare-branch.outputs.GIT_COMMIT }}', | |
}); |