Skip to content

Commit 5580687

Browse files
author
hwk2077
committed
ok
1 parent f83ba67 commit 5580687

2 files changed

Lines changed: 25 additions & 60 deletions

File tree

action.yaml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,30 @@ branding:
66
runs:
77
using: "composite"
88
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
913
- name: Check
1014
shell: bash
11-
run: $GITHUB_ACTION_PATH/scripts/check.sh
12-
# run: |
13-
# git-log-flat-colored() {
14-
# git --no-pager log --format="%C(yellow)%h%Creset %C(cyan)%cd%Creset %s %Cgreen%an%Creset" --date=short "$@"
15-
# }
16-
#
17-
# CURRENT_FEATURE=$(git symbolic-ref --short -q HEAD)
18-
# CURRENT_PATH=$(git rev-parse --show-toplevel)
19-
# REFERENCE_BRANCH="origin/main"
20-
#
21-
# echo -e "\033[0;34m >>-----当前核查仓库路径${CURRENT_PATH}-----<< \033[0m"
22-
# git fetch origin main
23-
#
24-
# NB_COMMITS_BEHIND=$(git rev-list --left-right --count ${REFERENCE_BRANCH}...@ | cut -f1)
25-
#
26-
# if [ "${NB_COMMITS_BEHIND}" -gt "0" ]; then
27-
# echo -e "\033[0;31m >>-----${CURRENT_FEATURE}-----<< 当前分支有 ${NB_COMMITS_BEHIND} 个提交落后于 \"${REFERENCE_BRANCH}\", 请合并最新的 main 分支代码\n \033[0m"
28-
# git-log-flat-colored ${REFERENCE_BRANCH} | head -"${NB_COMMITS_BEHIND}"
29-
# exit 2
30-
# else
31-
# echo -e "\033[0;32m >>-----${CURRENT_FEATURE}-----<<当前分支包含 ${REFERENCE_BRANCH} 分支上的所有提交记录 \033[0m"
32-
# fi
15+
run: |
16+
git-log-flat-colored() {
17+
git --no-pager log --format="%C(yellow)%h%Creset %C(cyan)%cd%Creset %s %Cgreen%an%Creset" --date=short "$@"
18+
}
19+
20+
CURRENT_FEATURE=$(git symbolic-ref --short -q HEAD)
21+
CURRENT_PATH=$(git rev-parse --show-toplevel)
22+
REFERENCE_BRANCH="origin/main"
23+
24+
echo -e "\033[0;34m >>-----当前核查仓库路径${CURRENT_PATH}-----<< \033[0m"
25+
git fetch origin main
26+
27+
NB_COMMITS_BEHIND=$(git rev-list --left-right --count ${REFERENCE_BRANCH}...@ | cut -f1)
28+
29+
if [ "${NB_COMMITS_BEHIND}" -gt "0" ]; then
30+
echo -e "\033[0;31m >>-----${CURRENT_FEATURE}-----<< 当前分支有 ${NB_COMMITS_BEHIND} 个提交落后于 \"${REFERENCE_BRANCH}\", 请合并最新的 main 分支代码\n \033[0m"
31+
git-log-flat-colored ${REFERENCE_BRANCH} | head -"${NB_COMMITS_BEHIND}"
32+
exit 2
33+
else
34+
echo -e "\033[0;32m >>-----${CURRENT_FEATURE}-----<<当前分支包含 ${REFERENCE_BRANCH} 分支上的所有提交记录 \033[0m"
35+
fi

scripts/check.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)