devops: migrate automations to GitHub App (#35273)
This commit is contained in:
parent
eafcbd3437
commit
23c4c256b0
|
@ -59,10 +59,15 @@ jobs:
|
||||||
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
||||||
git checkout -b "$BRANCH_NAME"
|
git checkout -b "$BRANCH_NAME"
|
||||||
git push origin $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
|
- name: Create Pull Request
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ steps.app-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
const readableCommitHashesList = '${{ github.event.inputs.commit_hashes }}'.split(',').map(hash => `- ${hash}`).join('\n');
|
const readableCommitHashesList = '${{ github.event.inputs.commit_hashes }}'.split(',').map(hash => `- ${hash}`).join('\n');
|
||||||
const response = await github.rest.pulls.create({
|
const response = await github.rest.pulls.create({
|
||||||
|
|
|
@ -16,10 +16,20 @@ jobs:
|
||||||
if: github.repository == 'microsoft/playwright'
|
if: github.repository == 'microsoft/playwright'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
- name: Create GitHub issue
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ steps.app-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
const currentPlaywrightVersion = require('./package.json').version.match(/\d+\.\d+/)[0];
|
const currentPlaywrightVersion = require('./package.json').version.match(/\d+\.\d+/)[0];
|
||||||
const { data } = await github.rest.git.getCommit({
|
const { data } = await github.rest.git.getCommit({
|
||||||
|
|
|
@ -72,13 +72,19 @@ jobs:
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
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
|
- name: Deploy Canary
|
||||||
run: bash utils/build/deploy-trace-viewer.sh --canary
|
run: bash utils/build/deploy-trace-viewer.sh --canary
|
||||||
if: contains(github.ref, 'main')
|
if: contains(github.ref, 'main')
|
||||||
env:
|
env:
|
||||||
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
- name: Deploy BETA
|
- name: Deploy BETA
|
||||||
run: bash utils/build/deploy-trace-viewer.sh --beta
|
run: bash utils/build/deploy-trace-viewer.sh --beta
|
||||||
if: contains(github.ref, 'release')
|
if: contains(github.ref, 'release')
|
||||||
env:
|
env:
|
||||||
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
|
@ -14,7 +14,13 @@ jobs:
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
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
|
- name: Deploy Stable
|
||||||
run: bash utils/build/deploy-trace-viewer.sh --stable
|
run: bash utils/build/deploy-trace-viewer.sh --stable
|
||||||
env:
|
env:
|
||||||
GH_SERVICE_ACCOUNT_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
GH_SERVICE_ACCOUNT_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
|
@ -49,10 +49,15 @@ jobs:
|
||||||
git add .
|
git add .
|
||||||
git commit -m "feat(${BROWSER}): roll to r${REVISION}"
|
git commit -m "feat(${BROWSER}): roll to r${REVISION}"
|
||||||
git push origin $BRANCH_NAME --force
|
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
|
- name: Create Pull Request
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ steps.app-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
const response = await github.rest.pulls.create({
|
const response = await github.rest.pulls.create({
|
||||||
owner: 'microsoft',
|
owner: 'microsoft',
|
||||||
|
|
|
@ -33,11 +33,16 @@ jobs:
|
||||||
git add .
|
git add .
|
||||||
git commit -m "chore(driver): roll driver to recent Node.js LTS version"
|
git commit -m "chore(driver): roll driver to recent Node.js LTS version"
|
||||||
git push origin $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
|
- name: Create Pull Request
|
||||||
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
|
if: ${{ steps.prepare-branch.outputs.HAS_CHANGES == '1' }}
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
github-token: ${{ steps.app-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
await github.rest.pulls.create({
|
await github.rest.pulls.create({
|
||||||
owner: 'microsoft',
|
owner: 'microsoft',
|
||||||
|
|
|
@ -11,6 +11,12 @@ jobs:
|
||||||
name: "trigger"
|
name: "trigger"
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
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: |
|
- run: |
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-H "Accept: application/vnd.github.v3+json" \
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
|
@ -18,4 +24,4 @@ jobs:
|
||||||
--data "{\"event_type\": \"playwright_tests\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
|
--data "{\"event_type\": \"playwright_tests\", \"client_payload\": {\"ref\": \"${GITHUB_SHA}\"}}" \
|
||||||
https://api.github.com/repos/microsoft/playwright-browsers/dispatches
|
https://api.github.com/repos/microsoft/playwright-browsers/dispatches
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_PERSONAL_ACCESS_TOKEN }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
Loading…
Reference in New Issue