File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -70,22 +70,24 @@ jobs:
70
70
if [[ -n "${{ github.event.inputs.target_repository }}" && "${{ github.event.inputs.target_repository }}" != "${{ github.repository }}" ]]; then
71
71
echo "Adding remote for target repository: ${{ github.event.inputs.target_repository }}"
72
72
git remote add target_repo "https://github.com/${{ github.event.inputs.target_repository }}.git"
73
+ git fetch target_repo $CURRENT_BRANCH || true
73
74
git checkout -b $CURRENT_BRANCH target_repo/$CURRENT_BRANCH
74
75
else
76
+ git fetch origin $CURRENT_BRANCH || true
75
77
git checkout -b $CURRENT_BRANCH origin/$CURRENT_BRANCH
76
78
fi
77
79
if [[ -n "$PR_NUMBER" ]]; then
78
80
# Get the base branch from the PR
79
81
BASE_BRANCH=$(gh pr view $PR_NUMBER --json baseRefName --jq '.baseRefName')
80
82
echo "This branch has PR #$PR_NUMBER from $CURRENT_BRANCH to $BASE_BRANCH"
81
83
# Get the merge-base of the base branch and current commit
82
- git fetch origin $BASE_BRANCH
84
+ git fetch origin $BASE_BRANCH || true
83
85
BASE_SHA=$(git merge-base target_repo/$BASE_BRANCH $CURRENT_BRANCH)
84
86
85
87
else
86
88
# For non-PRs, use merge-base of current branch and master as base_sha
87
89
echo "This is not a PR, using merge-base with master"
88
- git fetch origin master
90
+ git fetch origin master || true
89
91
BASE_SHA=$(git merge-base master $CURRENT_BRANCH)
90
92
fi
91
93
You can’t perform that action at this time.
0 commit comments