mirror of
https://github.com/microsoft/playwright.git
synced 2026-09-14 14:08:10 +08:00
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
name: "dependabot"
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
rebuild:
|
|
name: update generated files
|
|
runs-on: ubuntu-latest
|
|
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'microsoft/playwright'
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Add generated files to the PR
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
if [[ -n "$(git status --porcelain)" ]]; then
|
|
git add .
|
|
git commit -m "chore: update generated files after dependency update"
|
|
git push origin HEAD:${{ github.head_ref }}
|
|
# Pushing with GITHUB_TOKEN does not retrigger workflow runs, see:
|
|
# https://docs.github.com/en/actions/concepts/security/github_token#when-github_token-triggers-workflow-runs
|
|
# Close and reopen the PR to fire a pull_request reopened event, which
|
|
# retriggers infra.yml on the new commit.
|
|
gh pr close ${{ github.event.pull_request.number }}
|
|
# Remove labels after closing to avoid triggering bots that may rerun CI.
|
|
gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels -X DELETE
|
|
gh pr reopen ${{ github.event.pull_request.number }}
|
|
else
|
|
echo "No generated files changed, nothing to commit."
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|