Skip to content

Commit 7b01e66

Browse files
committed
build: ensure fetching from upstream repository and not fork
1 parent 60e6b6e commit 7b01e66

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

.github/workflows/pr_merge_develop.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,18 @@ jobs:
108108
BRANCH_NAME: ${{ steps.pr-details.outputs.branch }}
109109
REPO_NAME: ${{ steps.pr-details.outputs.repository }}
110110
run: |
111+
# Configure Git user:
111112
git config --local user.email "[email protected]"
112113
git config --local user.name "stdlib-bot"
113-
git fetch origin develop:develop
114-
git merge develop --no-edit
114+
115+
# Add upstream remote pointing to the original repository:
116+
git remote add upstream https://github.com/stdlib-js/stdlib.git
117+
118+
# Fetch the develop branch from upstream:
119+
git fetch upstream develop
120+
121+
# Merge upstream develop into the current branch:
122+
git merge upstream/develop --no-edit
123+
124+
# Push the updated branch back to the forked repository:
115125
git push "https://$USER_NAME:[email protected]/$REPO_NAME.git" $BRANCH_NAME

.github/workflows/pr_rebase_develop.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,18 @@ jobs:
108108
BRANCH_NAME: ${{ steps.pr-details.outputs.branch }}
109109
REPO_NAME: ${{ steps.pr-details.outputs.repository }}
110110
run: |
111+
# Configure Git user:
111112
git config --local user.email "[email protected]"
112113
git config --local user.name "stdlib-bot"
113-
git fetch origin develop:develop
114-
git rebase develop
114+
115+
# Add upstream remote pointing to the original repository:
116+
git remote add upstream https://github.com/stdlib-js/stdlib.git
117+
118+
# Fetch the develop branch from upstream:
119+
git fetch upstream develop
120+
121+
# Rebase current branch onto upstream develop:
122+
git rebase upstream/develop
123+
124+
# Force push the updated branch back to the forked repository:
115125
git push --force-with-lease "https://$USER_NAME:[email protected]/$REPO_NAME.git" $BRANCH_NAME

0 commit comments

Comments
 (0)