ci: remove fetch-parameters step logic

This commit is contained in:
Feng Chao 2025-03-12 20:10:10 +08:00
parent bd2a323915
commit eff801e97b
1 changed files with 35 additions and 33 deletions

View File

@ -30,46 +30,48 @@ jobs:
id: parameters id: parameters
run: | run: |
set -euo pipefail set -euo pipefail
target_branch=${{ github.event.pull_request.base.ref }} # target_branch=${{ github.event.pull_request.base.ref }}
# Fetch the latest code from the target branch # # Fetch the latest code from the target branch
cd ${{ env.WKC }} # cd ${{ env.WKC }}
git reset --hard # git reset --hard
git clean -f # git clean -f
git remote prune origin # git remote prune origin
git fetch # git fetch
git checkout "$target_branch" # git checkout "$target_branch"
git remote prune origin # git remote prune origin
git pull >/dev/null # git pull >/dev/null
# Check whether to run tdgpt test cases # # Check whether to run tdgpt test cases
changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | grep -v "^docs/en/" | grep -v "^docs/zh/" | grep -v ".md$" | tr '\n' ' ' || :) # changed_files_non_doc=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | grep -v "^docs/en/" | grep -v "^docs/zh/" | grep -v ".md$" | tr '\n' ' ' || :)
echo "changed files exclude doc: ${changed_files_non_doc}" # echo "changed files exclude doc: ${changed_files_non_doc}"
if [[ -n "$changed_files_non_doc" && "$changed_files_non_doc" =~ (forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt) ]]; then # if [[ -n "$changed_files_non_doc" && "$changed_files_non_doc" =~ (forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt) ]]; then
run_tdgpt_test="true" # run_tdgpt_test="true"
else # else
run_tdgpt_test="false" # run_tdgpt_test="false"
fi # fi
echo "run tdgpt test: ${run_tdgpt_test}" # echo "run tdgpt test: ${run_tdgpt_test}"
# Check whether to run function test cases # # Check whether to run function test cases
changed_files_non_tdgpt=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | \ # changed_files_non_tdgpt=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD $target_branch) | \
grep -v "^docs/en/" | \ # grep -v "^docs/en/" | \
grep -v "^docs/zh/" | \ # grep -v "^docs/zh/" | \
grep -v ".md$" | \ # grep -v ".md$" | \
grep -Ev "forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt" | \ # grep -Ev "forecastoperator\.c|anomalywindowoperator\.c|tanalytics\.h|tanalytics\.c|tdgpt_cases\.task|analytics|tdgpt" | \
tr '\n' ' ' || :) # tr '\n' ' ' || :)
echo "changed files exclude tdgpt: ${changed_files_non_tdgpt}" # echo "changed files exclude tdgpt: ${changed_files_non_tdgpt}"
if [ -n "$changed_files_non_tdgpt" ]; then # if [ -n "$changed_files_non_tdgpt" ]; then
run_function_test="true" # run_function_test="true"
else # else
run_function_test="false" # run_function_test="false"
fi # fi
echo "run function test: ${run_function_test}" # echo "run function test: ${run_function_test}"
run_tdgpt_test="true"
run_function_test="true"
# Output the results for GitHub Actions # Output the results for GitHub Actions
echo "run_function_test=$run_function_test" >> $GITHUB_OUTPUT echo "run_function_test=$run_function_test" >> $GITHUB_OUTPUT
echo "run_tdgpt_test=$run_tdgpt_test" >> $GITHUB_OUTPUT echo "run_tdgpt_test=$run_tdgpt_test" >> $GITHUB_OUTPUT