Skip to content

Commit f822f31

Browse files
committed
trying to get it to work locally?
1 parent fe1b07d commit f822f31

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ tasks:
5050
params:
5151
binary: bash
5252
args:
53-
- .evergreen/scripts/resync_all_specs.sh
53+
- .evergreen/scripts/resync-all-specs.sh

.evergreen/scripts/create-pr.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# Get a github access token for the git checkout.
4+
echo "Getting github token..."
5+
# clone drivers-evergreen-tools to get this get-access-token script...
6+
tools="../../../drivers-evergreen-tools"
7+
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $tools
8+
9+
owner="mongodb"
10+
repo="mongo-python-driver"
11+
token=$(bash $tools/.evergreen/github_app/get-access-token.sh $repo $owner)
12+
if [ -z "${token}" ]; then
13+
echo "Failed to get github access token!"
14+
exit 1
15+
fi
16+
echo "Getting github token... done."
17+
18+
# Make the git checkout and create a new branch.
19+
echo "Creating the git checkout..."
20+
branch="spec-resync-"$(date '+%m-%d-%Y')
21+
body="$(cat spec_sync.txt)"
22+
23+
git config user.email "167856002+mongodb-dbx-release-bot[bot]@users.noreply.github.com"
24+
git config user.name "mongodb-dbx-release-bot[bot]"
25+
git remote set-url origin https://x-access-token:${token}@github.com/$owner/$repo.git
26+
git checkout -b $branch "origin/main"
27+
echo "Creating the git checkout... done."
28+
29+
git push origin $branch
30+
resp=$(curl -L \
31+
-X POST \
32+
-H "Accept: application/vnd.github+json" \
33+
-H "Authorization: Bearer $token" \
34+
-H "X-GitHub-Api-Version: 2022-11-28" \
35+
-d "{\"title\":\"[Spec Resync] $(date '+%m-%d-%Y')\",\"body\":\"${body}\",\"head\":\"${branch}\",\"base\":\"main\"}" \
36+
--url https://api.github.com/repos/$owner/$repo/pulls)
37+
echo $resp | jq '.html_url'
38+
echo "Creating the PR... done."
39+
40+
rm -rf $dirname

.evergreen/scripts/resync_all_specs.sh renamed to .evergreen/scripts/resync-all-specs.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Run spec syncing script and create PR
33

44
SPEC_DEST="../../test"
@@ -39,7 +39,7 @@ changed_specs=()
3939
errored_specs=()
4040

4141
# Create branch and switch to it
42-
git checkout -b $BRANCH_NAME 2>/dev/null || git checkout $BRANCH_NAME
42+
#git checkout -b $BRANCH_NAME 2>/dev/null || git checkout $BRANCH_NAME
4343

4444
for item in "$SPEC_DEST"/*; do
4545
item_name=$(basename "$item")
@@ -86,9 +86,13 @@ else
8686
fi
8787

8888
# Output the PR body (optional step for verification)
89-
echo -e "$pr_body"
89+
echo "$pr_body" >> spec_sync.txt
9090

91-
git add $SPEC_DEST
92-
git commit -m $BRANCH_NAME
93-
git push -u origin $BRANCH_NAME
91+
# call scrypt to create PR for us
92+
./create-pr.sh
93+
94+
rm spec_sync.txt
95+
#git add $SPEC_DEST
96+
#git commit -m $BRANCH_NAME
97+
#git push -u origin $BRANCH_NAME
9498
#gh pr create --title "[Spec Resync] $(date '+%m-%d-%Y')" --body "Resyncing specs for review" --base main --head $BRANCH_NAME --draft

0 commit comments

Comments
 (0)