devops: migrate automations to GitHub App (#35273)

This commit is contained in:
Max Schmitt 2025-03-19 14:39:39 +01:00 committed by GitHub
parent eafcbd3437
commit 23c4c256b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 52 additions and 9 deletions

View File

@ -59,10 +59,15 @@ jobs:
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b "$BRANCH_NAME"
git push origin $BRANCH_NAME
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- name: Create Pull Request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
const readableCommitHashesList = '${{ github.event.inputs.commit_hashes }}'.split(',').map(hash => `- ${hash}`).join('\n');
const response = await github.rest.pulls.create({

View File

@ -16,10 +16,20 @@ jobs:
if: github.repository == 'microsoft/playwright'
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: |
playwright
playwright-python
playwright-java
playwright-dotnet
- name: Create GitHub issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
const currentPlaywrightVersion = require('./package.json').version.match(/\d+\.\d+/)[0];
const { data } = await github.rest.git.getCommit({
@ -61,4 +71,4 @@ jobs:
issue_number: issueNumber,
body: newBody
})
}
}

View File

@ -72,13 +72,19 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: playwright.dev
- name: Deploy Canary
run: bash utils/build/deploy-trace-viewer.sh --canary
if: contains(github.ref, 'main')
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Deploy BETA
run: bash utils/build/deploy-trace-viewer.sh --beta
if: contains(github.ref, 'release')
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}

View File

@ -14,7 +14,13 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: playwright.dev
- name: Deploy Stable
run: bash utils/build/deploy-trace-viewer.sh --stable
env:
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}

View File

@ -49,10 +49,15 @@ jobs:
git add .
git commit -m "feat(${BROWSER}): roll to r${REVISION}"
git push origin $BRANCH_NAME --force
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- name: Create Pull Request
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
const response = await github.rest.pulls.create({
owner: 'microsoft',

View File

@ -33,11 +33,16 @@ jobs:
git add .
git commit -m "chore(driver): roll driver to recent Node.js LTS version"
git push origin $BRANCH_NAME
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
- name: Create Pull Request
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ steps.app-token.outputs.token }}
script: |
await github.rest.pulls.create({
owner: 'microsoft',

View File

@ -11,6 +11,12 @@ jobs:
name: "trigger"
runs-on: ubuntu-24.04
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
repositories: playwright-browsers
- run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
@ -18,4 +24,4 @@ jobs:
--data "{\"event_type\": \"playwright_tests\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
https://api.github.com/repos/microsoft/playwright-browsers/dispatches
env:
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}