Skip to content

Commit a23a1d9

Browse files
committed
devops(roll): roll on Mon, Wed and Fri at night, drop the needs-roll label
1 parent 5e3e021 commit a23a1d9

2 files changed

Lines changed: 26 additions & 87 deletions

File tree

‎.github/workflows/roll.yml‎

Lines changed: 24 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
name: Roll to latest Playwright
99

1010
on:
11-
# Apply needs-roll to an issue to roll to the tip of main; re-apply it to trigger another roll.
12-
issues:
13-
types: [labeled]
11+
# Mon, Wed and Fri at 9:17 UTC: 2:17 at night Pacific time, 1:17 in winter. Not on the hour, when
12+
# GitHub delays scheduled runs. A scheduled roll skips while a roll pull request is open.
13+
schedule:
14+
- cron: "17 9 * * 1,3,5"
1415
workflow_dispatch:
1516
inputs:
1617
ref:
@@ -23,39 +24,18 @@ on:
2324
permissions: {}
2425

2526
jobs:
26-
start:
27-
name: Post the run link on the issue
28-
if: github.repository == 'microsoft/playwright-python' && github.event.label.name == 'needs-roll'
29-
runs-on: ubuntu-latest
30-
permissions:
31-
issues: write
32-
outputs:
33-
comment: ${{ steps.post.outputs.id }}
34-
env:
35-
ISSUE: ${{ github.event.issue.number }}
36-
GH_TOKEN: ${{ github.token }}
37-
GH_REPO: ${{ github.repository }}
38-
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
39-
steps:
40-
- name: Post the run link
41-
id: post
42-
run: |
43-
body=$(printf "Hi, I'm the Playwright bot. I started to roll Playwright to the tip of main: [agent run](%s)\n<!-- playwright-roll-started -->" "$WORKFLOW_URL")
44-
id=$(gh api "repos/$GH_REPO/issues/$ISSUE/comments" -f body="$body" --jq .node_id)
45-
echo "id=$id" >> "$GITHUB_OUTPUT"
46-
4727
versions:
4828
name: Find the commit
49-
if: >-
50-
github.repository == 'microsoft/playwright-python' &&
51-
(github.event_name == 'workflow_dispatch' || github.event.label.name == 'needs-roll')
29+
if: github.repository == 'microsoft/playwright-python'
5230
runs-on: ubuntu-24.04
5331
permissions:
5432
contents: read
33+
pull-requests: read
5534
outputs:
5635
old_commit: ${{ steps.versions.outputs.old_commit }}
5736
new_commit: ${{ steps.versions.outputs.new_commit }}
5837
new_short: ${{ steps.versions.outputs.new_short }}
38+
open_roll: ${{ steps.open.outputs.pr }}
5939
steps:
6040
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6141
- name: Read the pinned and the new commit
@@ -71,16 +51,30 @@ jobs:
7151
echo "new_commit=${new_commit}"
7252
echo "new_short=${new_commit:0:10}"
7353
} >> "$GITHUB_OUTPUT"
54+
# A manual run rolls anyway: a maintainer asked for it.
55+
- name: Look for an open roll pull request
56+
id: open
57+
if: github.event_name == 'schedule'
58+
env:
59+
GH_TOKEN: ${{ github.token }}
60+
GH_REPO: ${{ github.repository }}
61+
run: |
62+
pr=$(gh pr list --state open --author app/microsoft-playwright-automation --json number,headRefName \
63+
--jq '[.[] | select(.headRefName | startswith("roll/")) | .number] | first // empty')
64+
if [[ -n "$pr" ]]; then
65+
echo "pr=$pr" >> "$GITHUB_OUTPUT"
66+
echo "Skipped: roll pull request #$pr is open." >> "$GITHUB_STEP_SUMMARY"
67+
fi
7468
7569
roll:
7670
name: Roll to ${{ needs.versions.outputs.new_short }}
7771
needs: versions
78-
if: needs.versions.outputs.new_commit != needs.versions.outputs.old_commit
72+
if: >-
73+
needs.versions.outputs.new_commit != needs.versions.outputs.old_commit &&
74+
needs.versions.outputs.open_roll == ''
7975
# The runner of CI: the skill runs ./test.sh, both suites on all its cores.
8076
runs-on: playwright-x64-ubuntu24-64-core
8177
timeout-minutes: 240
82-
# On the job and not on the workflow: every issue label starts this workflow, and a skipped
83-
# run would replace a roll that waits in a group of the workflow.
8478
concurrency:
8579
group: roll
8680
cancel-in-progress: false
@@ -153,7 +147,6 @@ jobs:
153147
env:
154148
COMPLETE: ${{ steps.agent.outputs.outcome == 'success' && steps.check.outcome == 'success' }}
155149
TITLE: "chore: roll Playwright to ${{ steps.record.outputs.version }} (${{ needs.versions.outputs.new_short }})"
156-
ISSUE_URL: ${{ github.event.issue.html_url }}
157150
COMPARE_URL: https://github.com/microsoft/playwright/compare/${{ needs.versions.outputs.old_commit }}...${{ needs.versions.outputs.new_commit }}
158151
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
159152
run: |
@@ -187,8 +180,6 @@ jobs:
187180
commits.append(f"- … and {total - len(commits)} more: {env['COMPARE_URL']}")
188181
parts.append(f"<details>\n<summary>Upstream commits ({total})</summary>\n\n" + "\n".join(commits) + "\n\n</details>")
189182
parts.append(f"Upstream changes: {env['COMPARE_URL']}")
190-
if env.get("ISSUE_URL"):
191-
parts.append(f"Fixes {env['ISSUE_URL']}")
192183
Path(env["PATCH_DIR"], "pr-body.md").write_text("\n\n".join(parts) + "\n", encoding="utf-8")
193184
Path(env["PATCH_DIR"], "roll.json").write_text(json.dumps({"title": env["TITLE"]}) + "\n", encoding="utf-8")
194185
EOF
@@ -264,7 +255,6 @@ jobs:
264255
metadata: roll.json
265256
body-file: pr-body.md
266257
branch: roll/${{ needs.versions.outputs.new_short }}/${{ github.run_id }}-${{ github.run_attempt }}
267-
commit-body: "${{ github.event.issue.html_url && format('Fixes: {0}', github.event.issue.html_url) || '' }}"
268258
pull-request: true
269259
base: ${{ github.ref_name }}
270260
workflow-name: roll workflow
@@ -276,54 +266,3 @@ jobs:
276266
GH_REPO: ${{ github.repository }}
277267
PR: ${{ steps.publish.outputs.number }}
278268
run: gh pr ready "$PR"
279-
280-
comment:
281-
name: Comment on the issue
282-
needs: [start, versions, roll, publish]
283-
# Runs after every run that the label started, including failed ones, and whatever publish did.
284-
if: ${{ !cancelled() && needs.start.result != 'skipped' }}
285-
runs-on: ubuntu-latest
286-
permissions:
287-
issues: write
288-
steps:
289-
- name: Post the result and hide the run link
290-
env:
291-
GH_TOKEN: ${{ github.token }}
292-
GH_REPO: ${{ github.repository }}
293-
ISSUE: ${{ github.event.issue.number }}
294-
START_COMMENT: ${{ needs.start.outputs.comment }}
295-
VERSIONS_RESULT: ${{ needs.versions.result }}
296-
OLD_COMMIT: ${{ needs.versions.outputs.old_commit }}
297-
NEW_COMMIT: ${{ needs.versions.outputs.new_commit }}
298-
ROLL_RESULT: ${{ needs.roll.result }}
299-
SETUP_OUTCOME: ${{ needs.roll.outputs.setup }}
300-
VERSION: ${{ needs.roll.outputs.version }}
301-
COMPLETE: ${{ needs.roll.outputs.complete }}
302-
PR_URL: ${{ needs.publish.outputs.pr }}
303-
PUBLISH_RESULT: ${{ needs.publish.result }}
304-
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
305-
run: |
306-
commit="microsoft/playwright@${NEW_COMMIT:0:10}"
307-
if [[ "$VERSIONS_RESULT" != "success" ]]; then
308-
text="I couldn't roll Playwright: finding the commit to roll to failed."
309-
elif [[ "$OLD_COMMIT" == "$NEW_COMMIT" ]]; then
310-
text="Nothing to roll: \`DRIVER_VERSION\` is at the tip of main already, $commit."
311-
elif [[ -n "$PR_URL" && "$COMPLETE" == "true" ]]; then
312-
text="I rolled Playwright to $VERSION, $commit: $PR_URL"
313-
elif [[ -n "$PR_URL" ]]; then
314-
text="I rolled Playwright to $VERSION, $commit, but the roll is not complete: the agent or the checks failed. Draft PR: $PR_URL"
315-
elif [[ "$PUBLISH_RESULT" == "failure" ]]; then
316-
text="I rolled Playwright to $VERSION, $commit, but opening the pull request failed."
317-
elif [[ "$SETUP_OUTCOME" == "failure" ]]; then
318-
text="I couldn't roll Playwright to $commit: pinning, generating the API, building the driver or installing the browsers failed."
319-
elif [[ "$ROLL_RESULT" == "success" ]]; then
320-
text="I couldn't roll Playwright to $commit: the roll changed no file."
321-
else
322-
text="I couldn't roll Playwright to $commit: the roll job ended with result \`$ROLL_RESULT\`, for example after a timeout."
323-
fi
324-
printf "Hi, I'm the Playwright bot. %s\n\n<sub>Rolled by the Playwright bot - [agent run](%s)</sub>\n<!-- playwright-roll -->\n" "$text" "$RUN_URL" > "$RUNNER_TEMP/comment.md"
325-
gh issue comment "$ISSUE" --body-file "$RUNNER_TEMP/comment.md"
326-
if [[ -n "$START_COMMENT" ]]; then
327-
gh api graphql -f query='mutation($id: ID!) { minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) { clientMutationId } }' -f id="$START_COMMENT" \
328-
|| echo "::warning::Could not hide the comment with the run link"
329-
fi

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ left).
139139
## Rolls
140140

141141
Use the `playwright-roll` skill. On CI, `.github/workflows/roll.yml` runs it and opens the
142-
PR. Apply the `needs-roll` label to an issue to roll to the tip of `main`, or start the
143-
workflow by hand with a branch, a tag or a commit.
142+
PR, on Mon, Wed and Fri at night unless a roll PR is open. To roll at another time, start
143+
the workflow by hand with a branch, a tag or a commit.
144144

145145
## Commits and PRs
146146

0 commit comments

Comments
 (0)