From 03c02e3946fa4d6043327ffa26260273c07103aa Mon Sep 17 00:00:00 2001 From: Liu Shilong Date: Fri, 10 Mar 2023 14:14:51 +0800 Subject: [PATCH] [action] Update AutoMergeScan action to ignore Semgrep and rerun failed job. (#14118) Why I did it Semgrep check has some issues. Ignore it. check automerge label. Ignore Azure.sonic-buildimage sub test jobs. Only check final result. How I did it --- .github/workflows/automerge_scan.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/automerge_scan.yml b/.github/workflows/automerge_scan.yml index b89e594720e7..5be1df1314d9 100644 --- a/.github/workflows/automerge_scan.yml +++ b/.github/workflows/automerge_scan.yml @@ -30,6 +30,9 @@ jobs: echo PR: $(($i+1))/$count, URL: $url, createdAt: $created_at, now: $(date -u +"%FT%TZ") [[ "$url" == "" ]] && continue [[ $created_at > $(date --date "1 hour ago" -u +"%FT%TZ") ]] && continue + # only check automerge PR. + cat prs.log | jq -r ".[$i].labels[].name" | grep automerge || continue + checks=$(cat prs.log | jq ".[$i].statusCheckRollup") checks_count=$(echo $checks | jq 'length') echo Checks count: $checks_count @@ -38,9 +41,14 @@ jobs: check=$(echo $checks | jq ".[$j]") state=$(echo $check | jq -r '.state') conclusion=$(echo $check | jq -r '.conclusion') + name=$(echo $check | jq -r '.name') # EasyCLA success flag: state=SUCCESS # Others success flag: conclusion in SUCCESS,NEUTRAL + # Ignore Azure.sonic-buildimage stage check result. It may be set continueOnError + echo "$name" | grep "Azure.sonic-buildimage (" && continue + # Ignore Semgrep, it has issues. + [[ "$name" == "Semgrep" ]] && continue if [[ "$state" == "SUCCESS" ]];then # check pass continue