File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -63,22 +63,25 @@ jobs:
63
63
GH_TOKEN : ${{ github.token }}
64
64
run : |
65
65
# Get the current branch name
66
- CURRENT_BRANCH=${GITHUB_REF#refs/heads/ }
66
+ CURRENT_BRANCH=${{ github.event.inputs.target_branch || github.ref } }
67
67
echo "Current branch: $CURRENT_BRANCH"
68
68
69
69
# Check if this is a PR
70
70
# Check if this branch has an associated PR
71
71
PR_NUMBER=$(gh pr list --repo mit-plv/fiat-crypto --head $CURRENT_BRANCH --json number --jq '.[0].number')
72
+ git remote add upstream https://github.com/mit-plv/fiat-crypto.git
72
73
if [[ -n "$PR_NUMBER" ]]; then
73
74
# Get the base branch from the PR
74
75
BASE_BRANCH=$(gh pr view $PR_NUMBER --json baseRefName --jq '.baseRefName')
75
76
echo "This branch has PR #$PR_NUMBER from $CURRENT_BRANCH to $BASE_BRANCH"
76
77
# Get the merge-base of the base branch and current commit
77
- BASE_SHA=$(git merge-base origin/$BASE_BRANCH $GITHUB_SHA)
78
+ git fetch upstream $BASE_BRANCH
79
+ BASE_SHA=$(git merge-base upstream/$BASE_BRANCH $GITHUB_SHA)
78
80
else
79
81
# For non-PRs, use merge-base of current branch and master as base_sha
80
82
echo "This is not a PR, using merge-base with master"
81
- BASE_SHA=$(git merge-base origin/master $GITHUB_SHA)
83
+ git fetch upstream master
84
+ BASE_SHA=$(git merge-base upstream/master $GITHUB_SHA)
82
85
fi
83
86
84
87
echo "Using base SHA: $BASE_SHA"
You can’t perform that action at this time.
0 commit comments