infra Actions: If no coding style error, no comment

and change action name
This commit is contained in:
JunsuChoi 2021-04-26 16:20:35 +09:00 committed by Hermet Park
parent 3d5006740c
commit 94f3d0dc11
3 changed files with 5 additions and 10 deletions

View file

@ -1,4 +1,4 @@
name: Continuous-integration name: Build Test
on: on:
pull_request: pull_request:

View file

@ -1,4 +1,4 @@
name: PullRequest_Checker name: Check Commit
on: on:
pull_request: pull_request:
@ -6,7 +6,7 @@ on:
- master - master
jobs: jobs:
build: coding-style:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View file

@ -37,7 +37,7 @@ cpplint --filter=-,\
PAYLOAD_CPPLINT=`cat cpp-report.txt` PAYLOAD_CPPLINT=`cat cpp-report.txt`
COMMENTS_URL=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.comments_url) COMMENTS_URL=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.comments_url)
echo $COMMENTS_URL echo $COMMENTS_URL
echo "Cppcheck errors:" echo "Cppcheck errors:"
echo $PAYLOAD_CPPLINT echo $PAYLOAD_CPPLINT
@ -47,13 +47,8 @@ if [[ $PAYLOAD_CPPLINT == *"Total errors found: "* ]]; then
OUTPUT+=$'\n```\n' OUTPUT+=$'\n```\n'
OUTPUT+="$PAYLOAD_CPPLINT" OUTPUT+="$PAYLOAD_CPPLINT"
OUTPUT+=$'\n```\n' OUTPUT+=$'\n```\n'
else
OUTPUT+=$'\n**CODING STYLE CHECK**:\n'
OUTPUT+=$'\n```\n'
OUTPUT+="Perfect."
OUTPUT+=$'\n```\n'
fi fi
PAYLOAD=$(echo '{}' | jq --arg body "$OUTPUT" '.body = $body') PAYLOAD=$(echo '{}' | jq --arg body "$OUTPUT" '.body = $body')
curl -s -S -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/vnd.github.VERSION.text+json" --data "$PAYLOAD" "$COMMENTS_URL" curl -s -S -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/vnd.github.VERSION.text+json" --data "$PAYLOAD" "$COMMENTS_URL"