Skip to content

Commit d3317e5

Browse files
author
cowork-bot
committed
cowork-bot: seed cowork-auto-pr workflow for auto PR creation
1 parent 7f02726 commit d3317e5

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Seeded by the repo-improver-rotation Cowork job into cowork/improve-* branches.
2+
# Opens a PR automatically when such a branch is pushed (sandbox cannot reach
3+
# the GitHub API directly; this runs server-side with the repo's GITHUB_TOKEN).
4+
name: cowork-auto-pr
5+
on:
6+
push:
7+
branches: ['cowork/improve-**']
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
jobs:
12+
ensure-pr:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Open PR for this branch if none exists
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
run: |
19+
set -eu
20+
existing=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$GITHUB_REF_NAME" --state open --json number --jq 'length')
21+
if [ "$existing" = "0" ]; then
22+
gh pr create --repo "$GITHUB_REPOSITORY" \
23+
--head "$GITHUB_REF_NAME" \
24+
--title "cowork-bot: automated improvements ($GITHUB_REF_NAME)" \
25+
--body "Automated improvement PR from the Cowork repo-improver rotation (one coherent senior-dev improvement per run; see individual commit messages). Subsequent runs push additional commits to this PR rather than opening new ones."
26+
else
27+
echo "Open PR already exists for $GITHUB_REF_NAME — nothing to do."
28+
fi

0 commit comments

Comments
 (0)