File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,11 +42,20 @@ workflow:
4242- cd ..
4343
4444.clone_reports : &clone_reports
45- - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/faradaysec/support/report-collection.git
46- - cd report-collection
47- - (git branch -a | grep $CI_COMMIT_BRANCH) && export REPORT_REF=$CI_COMMIT_BRANCH || export REPORT_REF=master
48- - git checkout $REPORT_REF
49- - cd ..
45+ - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/faradaysec/support/report-collection.git
46+ - cd report-collection
47+ - |
48+ SUFFIX="${CI_COMMIT_BRANCH#*_}"
49+ MATCH_BRANCH=$(git branch -r --list "*_reports_for_${SUFFIX}" | sed 's|origin/||' | head -n 1 | xargs)
50+ if [ -n "$MATCH_BRANCH" ]; then
51+ echo "Using branch from report-collection: $MATCH_BRANCH"
52+ REPORT_REF="$MATCH_BRANCH"
53+ else
54+ echo "Can't find branch *_reports_for_${SUFFIX}, will use master"
55+ REPORT_REF="master"
56+ fi
57+ git checkout "$REPORT_REF"
58+ - cd ..
5059
5160bandit :
5261 stage : SAST
You can’t perform that action at this time.
0 commit comments