devops: add workflow to roll new browser into PW (#8253)

This commit is contained in:
Max Schmitt 2021-08-17 14:23:40 +02:00 committed by GitHub
parent 91e9483f8e
commit e92924221a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,42 @@
name: Roll Browser into Playwright
on:
repository_dispatch:
types: [roll_into_pw]
jobs:
roll:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm ci
- run: npm run build
- name: Roll to new revision
run: |
./utils/roll_browser.js ${{ github.event.client_payload.browser }} ${{ github.event.client_payload.revision }}
- name: Prepare branch
id: prepare-branch
run: |
BASE_POSITION="${{ steps.bump-chromium.outputs.BASE_POSITION }}"
BRANCH_NAME="roll-${{ github.event.client_payload.browser }}/${{ github.event.client_payload.revision }}"
echo "::set-output name=BRANCH_NAME::$BRANCH_NAME"
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(${{ github.event.client_payload.browser }}): roll to r${{ github.event.client_payload.revision }}"
git push origin $BRANCH_NAME
- name: Create Pull Request
uses: actions/github-script@v4
with:
script: |
await github.pulls.create({
owner: 'microsoft',
repo: 'playwright',
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
base: 'master',
title: 'feat(${{ github.event.client_payload.browser }}): roll to r${{ github.event.client_payload.revison }}',
});

View File

@ -403,6 +403,14 @@ function generate_and_upload_browser_build {
return 0
}
function create_roll_into_playwright_pr {
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
--data '{"event_type": "roll_into_pw", "client_payload": {"browser": "'"$1"'", "revision": "'"$1"'"}}' \
https://api.github.com/repos/microsoft/playwright/dispatches
}
source ./send_telegram_message.sh
BUILD_ALIAS="$BUILD_FLAVOR r$BUILD_NUMBER"
send_telegram_message "$BUILD_ALIAS -- started"
@ -427,6 +435,7 @@ if generate_and_upload_browser_build 2>&1 | ./sanitize_and_compress_log.js $LOG_
done;
LAST_COMMIT_MESSAGE=$(git log --format=%s -n 1 HEAD -- "./${BROWSER_NAME}/BUILD_NUMBER")
send_telegram_message "<b>${BROWSER_DISPLAY_NAME} r${BUILD_NUMBER} COMPLETE! ✅</b> ${LAST_COMMIT_MESSAGE}"
create_roll_into_playwright_pr $BROWSER_NAME $BUILD_NUMBER
)
else
RESULT_CODE="$?"