Skip to content

Commit 9c6c8b0

Browse files
committed
roll skill.md and readme
1 parent ea85cea commit 9c6c8b0

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: "Roll CLI README"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 10 * * *"
7+
8+
jobs:
9+
roll:
10+
name: Roll CLI README
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
if: github.repository == 'microsoft/playwright-cli'
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Checkout playwright
19+
uses: actions/checkout@v4
20+
with:
21+
repository: microsoft/playwright
22+
path: ../playwright
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 24
26+
- name: Install dependencies
27+
run: npm ci
28+
working-directory: ../playwright
29+
- name: Build
30+
run: npm run build
31+
working-directory: ../playwright
32+
- name: Update files
33+
run: |
34+
cp ../playwright/packages/playwright/src/mcp/terminal/SKILL.md SKILL.md
35+
36+
node ../playwright/utils/generate_cli_help.js --readme > /tmp/cli_help.md
37+
sed -i -e '/<!-- BEGIN GENERATED CLI HELP -->/,/<!-- END GENERATED CLI HELP -->/{//!d}' \
38+
-e '/<!-- BEGIN GENERATED CLI HELP -->/r /tmp/cli_help.md' README.md
39+
40+
- name: Check for changes
41+
id: check-changes
42+
run: |
43+
if git diff --quiet; then
44+
echo "has_changes=false" >> $GITHUB_OUTPUT
45+
else
46+
echo "has_changes=true" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Prepare branch
50+
id: prepare-branch
51+
if: steps.check-changes.outputs.has_changes == 'true'
52+
run: |
53+
BRANCH_NAME="roll-cli-readme"
54+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
55+
56+
git config --global user.name microsoft-playwright-automation[bot]
57+
git config --global user.email 203992400+microsoft-playwright-automation[bot]@users.noreply.github.com
58+
59+
git checkout -b "$BRANCH_NAME"
60+
git add -A
61+
git commit -m "chore: roll CLI documentation"
62+
git push origin "$BRANCH_NAME" --force
63+
64+
- uses: actions/create-github-app-token@v2
65+
if: steps.check-changes.outputs.has_changes == 'true'
66+
id: app-token
67+
with:
68+
app-id: ${{ vars.PLAYWRIGHT_APP_ID }}
69+
private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }}
70+
71+
- name: Check for existing Pull Request
72+
id: check-pr
73+
if: steps.check-changes.outputs.has_changes == 'true'
74+
uses: actions/github-script@v7
75+
with:
76+
github-token: ${{ steps.app-token.outputs.token }}
77+
script: |
78+
const { data: pullRequests } = await github.rest.pulls.list({
79+
owner: 'microsoft',
80+
repo: 'playwright-cli',
81+
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
82+
state: 'open'
83+
});
84+
return pullRequests.length > 0 ? 'true' : 'false';
85+
result-encoding: string
86+
87+
- name: Create Pull Request
88+
if: steps.check-changes.outputs.has_changes == 'true' && steps.check-pr.outputs.result == 'false'
89+
uses: actions/github-script@v7
90+
with:
91+
github-token: ${{ steps.app-token.outputs.token }}
92+
script: |
93+
await github.rest.pulls.create({
94+
owner: 'microsoft',
95+
repo: 'playwright-cli',
96+
head: 'microsoft:${{ steps.prepare-branch.outputs.BRANCH_NAME }}',
97+
base: 'main',
98+
title: 'chore: roll CLI documentation',
99+
body: 'Automated roll from microsoft/playwright',
100+
});

0 commit comments

Comments
 (0)