11
11
12
12
PR_NUMBER=" $1 "
13
13
PATCH_FILE=" $2 "
14
+ TMP_BRANCH=" $3 "
14
15
if [ -z " $PR_NUMBER " ]; then
15
16
echo " Please provide a PR link or number. For example: https://github.com/ossrs/ffmpeg-webrtc/pull/20"
16
17
exit 1
52
53
53
54
git checkout workflows &&
54
55
echo " Switched to workflows branch." &&
55
- git pull
56
+ git pull &&
56
57
echo " Pulled latest changes from workflows branch."
57
58
if [[ $? -ne 0 ]]; then
58
59
echo " Failed to switch to workflows branch or pull latest changes."
@@ -71,7 +72,9 @@ if [[ $? -ne 0 ]]; then
71
72
exit 1
72
73
fi
73
74
74
- TMP_BRANCH=tmp-branch-for-patch-$PR_NUMBER &&
75
+ if [[ -z " $TMP_BRANCH " ]]; then
76
+ TMP_BRANCH=" tmp-branch-for-patch-$PR_NUMBER "
77
+ fi &&
75
78
if git branch --list " $TMP_BRANCH " | grep -q " ^..$TMP_BRANCH $" ; then
76
79
git branch -D " $TMP_BRANCH "
77
80
fi &&
@@ -90,7 +93,7 @@ if [[ -z "$FIRST_AUTHOR_NAME" || -z "$FIRST_AUTHOR_EMAIL" ]]; then
90
93
exit 1
91
94
fi
92
95
93
- COAUTHORS=$( git log workflows..HEAD --format=' Co-authored-by: %an <%ae>' | grep -v " $FIRST_AUTHOR_NAME " | sort -u)
96
+ COAUTHORS=$( git log workflows..HEAD --format=' Co-authored-by: %an <%ae>' | sort -u)
94
97
COAUTHOR_COUNT=$( echo " $COAUTHORS " | wc -l)
95
98
if [[ " $COAUTHOR_COUNT " -gt 0 ]]; then
96
99
echo " $COAUTHORS "
109
112
echo " Commit information:"
110
113
echo " Author: $FIRST_AUTHOR_NAME <$FIRST_AUTHOR_EMAIL >"
111
114
echo " ==================================================================="
112
- echo -n - e " $COMMIT_MSG "
115
+ echo -e " $COMMIT_MSG "
113
116
echo " ==================================================================="
114
117
echo " "
115
118
119
+ if [[ $( git config --list --local | grep ' user.name' > /dev/null 2>&1 && echo yes) != " yes" ]]; then
120
+ git config --local user.name " $FIRST_AUTHOR_NAME "
121
+ fi &&
122
+ if [[ $( git config --list --local | grep ' user.email' > /dev/null 2>&1 && echo yes) != " yes" ]]; then
123
+ git config --local user.email " $FIRST_AUTHOR_EMAIL "
124
+ fi &&
125
+ git config --list &&
126
+ echo " Set local git user configuration to: $FIRST_AUTHOR_NAME <$FIRST_AUTHOR_EMAIL >"
127
+ if [[ $? -ne 0 ]]; then
128
+ echo " Failed to set local git user configuration."
129
+ exit 1
130
+ fi
131
+
116
132
git rebase workflows &&
117
133
git reset --soft workflows &&
118
- git commit --author " $FIRST_AUTHOR_NAME <$FIRST_AUTHOR_EMAIL >" -m " $( echo -n - e " $COMMIT_MSG " ) " &&
119
- echo " Squashed commits into a single commit." &&
134
+ git commit --author " $FIRST_AUTHOR_NAME <$FIRST_AUTHOR_EMAIL >" -m " $( echo -e " $COMMIT_MSG " ) " &&
135
+ echo " Squashed commits into a single commit."
120
136
if [[ $? -ne 0 ]]; then
121
137
echo " Failed to rebase or commit changes."
122
138
exit 1
0 commit comments