[action] Update github workflows about automerge_scan and pr_cherrypick_prestep. (#15090)

Why I did it
When auto cherry pick workflow create PR, fill the body field.
Rerun Azure.sonic-buildimage on failure perday.
Work item tracking
Microsoft ADO (number only): 17979778
How I did it
How to verify it
This commit is contained in:
Liu Shilong 2023-05-17 11:06:50 +08:00 committed by GitHub
parent 93adb9c5e5
commit 6303cd91d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -47,6 +47,11 @@ jobs:
# 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
# rerun Azure.sonic-buildimage per day
if [[ "$name" == "Azure.sonic-buildimage" ]] && [[ "$conclusion" == "FAILURE" ]];then
completedAt=$(echo $check | jq -r '.completedAt')
[[ "$completedAt" < $(date --date "2 hour ago" -u +"%FT%TZ") ]] && [[ $(date -u +"%T") < "02:00:00" ]] && gh pr comment $url --body "/azp run Azure.sonic-buildimage"
fi
# Ignore Semgrep, it has issues.
[[ "$name" == "Semgrep" ]] && continue
if [[ "$state" == "SUCCESS" ]];then

View File

@ -9,7 +9,7 @@ on:
jobs:
pre_cherry_pick:
if: github.event.pull_request.merged == true && ( (github.event.action == 'closed' && contains(join(github.event.pull_request.labels.*.name, ','), 'Approved for 20')) || (github.event.action == 'labeled' && startsWith(github.event.label.name, 'Approved for 20')) )
if: github.repository_owner == 'sonic-net' && github.event.pull_request.merged == true && ( (github.event.action == 'closed' && contains(join(github.event.pull_request.labels.*.name, ','), 'Approved for 20')) || (github.event.action == 'labeled' && startsWith(github.event.label.name, 'Approved for 20')) )
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -39,6 +39,7 @@ jobs:
labels=$(echo $GITHUB_CONTEXT | jq -r ".event.label.name")
fi
title=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.title")
body=$(echo $GITHUB_CONTEXT | jq -r ".event.pull_request.body")
echo =============================
echo SHA: $sha
echo PRID: $pr_id
@ -50,6 +51,7 @@ jobs:
echo ${TOKEN} | gh auth login --with-token
echo author: $author
echo title: $title
echo body: "$body"
echo =============================
git config user.name mssonicbld
@ -105,7 +107,7 @@ jobs:
else
# Create PR to release branch
git push mssonicbld HEAD:cherry/$branch/${pr_id} -f
result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b '' 2>&1)
result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b "$body" 2>&1)
echo $result | grep "already exists" && { echo $result; return 0; }
echo $result | grep github.com || { echo $result; return 1; }
new_pr_rul=$(echo $result | grep github.com)