-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a convenient script to create internal PRs
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ test-asan *args="//...": | |
|
||
format: | ||
python3 tools/cross/format.py | ||
|
||
internal-pr: | ||
./tools/unix/create-internal-pr.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
# This tool will open a PR to update workerd in Cloudflare's internal repository | ||
# to match the current branch. | ||
|
||
set -euo pipefail | ||
|
||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) | ||
SYNC_BRANCH_NAME=sync/$BRANCH_NAME | ||
|
||
cd ../edgeworker | ||
git fetch origin master | ||
|
||
if git rev-parse --verify $SYNC_BRANCH_NAME; then | ||
BRANCH_EXISTS=1 | ||
else | ||
BRANCH_EXISTS=0 | ||
fi | ||
|
||
|
||
if [ $BRANCH_EXISTS -eq 1 ]; then | ||
git checkout $SYNC_BRANCH_NAME | ||
else | ||
git checkout master | ||
git checkout -b $SYNC_BRANCH_NAME | ||
fi | ||
|
||
git -C deps/workerd fetch origin $BRANCH_NAME | ||
git -C deps/workerd checkout origin/$BRANCH_NAME | ||
git add deps/workerd | ||
|
||
if [ $BRANCH_EXISTS -eq 1 ]; then | ||
git commit --amend | ||
git push --force origin HEAD | ||
else | ||
git commit -m "Sync with $BRANCH_NAME" | ||
git push origin HEAD | ||
open "https://bitbucket.cfdata.org/projects/EW/repos/edgeworker/pull-requests?create&sourceBranch=refs/heads/$SYNC_BRANCH_NAME" | ||
fi |