Skip to content

Commit

Permalink
feat: send conflict warning comment
Browse files Browse the repository at this point in the history
Signed-off-by: hlts2 <[email protected]>
  • Loading branch information
hlts2 committed Jul 29, 2024
1 parent 466779c commit ff8a2c3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/check-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit ff8a2c3

Please sign in to comment.