From 7d0e995e62b43a2feafd0db7da2ca765970ff0fd Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 23 Nov 2026 15:14:42 +0000 Subject: [PATCH] chore(bots): add the "Agent: update README" workflow Refs: https://github.com/microsoft/playwright-cli/issues/550 --- .github/workflows/agent-readme.yml | 73 ++++++++++++++++++++++++++++++ AGENTS.md | 1 + 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/agent-readme.yml diff --git a/.github/workflows/agent-readme.yml b/.github/workflows/agent-readme.yml new file mode 100644 index 0000000..5e46cdc --- /dev/null +++ b/.github/workflows/agent-readme.yml @@ -0,0 +1,73 @@ +# Keeps README.md in sync with the Playwright that main pins. Starts the Playwright bot with the +# task below. The bot compares the README with the pinned playwright-core, and opens the pull +# request as the app when the README is out of date. +name: "Agent: update README" + +on: + # Mondays at 9:17 UTC: 2:17 at night Pacific time, 1:17 in winter. Not on the hour, when GitHub + # delays scheduled runs. A scheduled run skips while a README pull request of the bot is open. + schedule: + - cron: "17 9 * * 1" + workflow_dispatch: + +permissions: {} + +jobs: + start: + name: Hand the task to the bot + if: github.repository == 'microsoft/playwright-cli' + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + pull-requests: read + steps: + # A manual run starts the bot anyway: a maintainer asked for it. The task gives the title. + - name: Look for an open README pull request + id: open + if: github.event_name == 'schedule' + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + pr=$(gh pr list --state open --base main --author app/microsoft-playwright-automation --json number,title \ + --jq '[.[] | select(.title | startswith("docs(readme): sync with Playwright")) | .number] | first // empty') + if [[ -n "$pr" ]]; then + echo "pr=$pr" >> "$GITHUB_OUTPUT" + echo "Skipped: README pull request #$pr is open." >> "$GITHUB_STEP_SUMMARY" + fi + - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + if: steps.open.outputs.pr == '' + id: app-token + with: + client-id: ${{ vars.PLAYWRIGHT_APP_CLIENT_ID }} + private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }} + owner: microsoft + repositories: devops.playwright.dev + permission-actions: write + - name: Start the bot + if: steps.open.outputs.pr == '' + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + TASK: >- + Update README.md so that it matches the Playwright that main pins: the playwright-core + version in package.json. Change README.md only. Do not roll Playwright, and do not + change skills/ or the tests. + Check each part of the README against its source. + Commands, their options and the examples: `node playwright-cli.js --help`, the help of + each command, and skills/playwright-cli/. + "Configuration file schema": the Config type in + packages/playwright-core/src/tools/mcp/config.d.ts of microsoft/playwright, at the + commit of the pin, which `npm view playwright-core@ gitHead` prints. + "Configuration via env": the PLAYWRIGHT_MCP_* variables that configFromEnv reads in + config.ts of the same directory, with the descriptions of their options in program.ts + there. + Leave out what only the MCP server reads, and run the CLI when the source does not tell. + Remove what the pin no longer has, add what is missing, and fix what is wrong. Keep the + structure and the wording of the rest. + The title of the pull request is `docs(readme): sync with Playwright `. Its + description lists what changed. + When the README is up to date, open no pull request, and say so in the summary. + run: | + gh workflow run task.yml --repo microsoft/devops.playwright.dev --ref main \ + -f repo="$GITHUB_REPOSITORY" -f task="$TASK" + echo "Started the README update." >> "$GITHUB_STEP_SUMMARY" diff --git a/AGENTS.md b/AGENTS.md index 7a7c152..f197509 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -82,6 +82,7 @@ The Playwright bot does the work below. It opens pull requests as the - `agent-implement` on an issue: implements what the issue and the maintainers' comments say. - `agent-review` on a PR: revises the PR, as the maintainers' review comments say. - [agent-roll.yml](.github/workflows/agent-roll.yml) and [agent-release.yml](.github/workflows/agent-release.yml), from the Actions tab: they hand a task to the bot. Roll Playwright to `playwright@next`, as the roll skill says. Or open the `chore: mark v` PR with the release notes as its description, as the release skill says. Copy the notes into the release draft. +- [agent-readme.yml](.github/workflows/agent-readme.yml), every Monday and from the Actions tab: hands a task to the bot. Compare `README.md` with the pinned Playwright, and open a `docs(readme): sync with Playwright ` PR when the README is out of date. A scheduled run skips while such a PR is open. - [agent-task.yml](.github/workflows/agent-task.yml), from the Actions tab: hands the bot the task that you type, with the skills of this repo. Apply a label again to start another run.