diff --git a/.github/workflows/check-conflict.yml b/.github/workflows/check-conflict.yml index 6eb494b977..5a8de3dbc6 100644 --- a/.github/workflows/check-conflict.yml +++ b/.github/workflows/check-conflict.yml @@ -36,6 +36,21 @@ jobs: - name: Check conflict run: | if grep -r "<<<< HEAD" . --exclude-dir=.git --exclude=check-conflict.yml; then + PR_COMMENTS=$(curl ${API_URL}?per_page=10000) + BODY=$(echo -E "${PR_COMMENTS}" | jq 'last(.[] | select(.user.login == "vdaas-ci") | select(.body | test("^\\\\*\\\\*\\\\[WARNING:CONFLICT")) | .body)' -r) + + if [ "$BODY" = "null" ]; then + curl --include --verbose --fail \ + -H "Accept: application/json" \ + -H "Content-Type:application/json" \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + --request POST \ + --data "{\"body\": \"**[WARNING:CONFLICT]** You may require to fix the conflict. Please check.\"}" \ + ${API_URL} + fi echo "Please fix conflict locally." exit 1 fi + env: + GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }} + API_URL: ${{ github.event.pull_request.comments_url }}