Update AI_to_merge_conflict.yml

Signed-off-by: jeet041 <mahorjitendra@gmail.com>
This commit is contained in:
jeet041 2025-04-17 17:41:39 +05:30 committed by GitHub
parent fc00109140
commit 316f10bd4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -41,14 +41,14 @@ jobs:
# run: echo "No merge conflicts detected. Skipping AI resolution." # run: echo "No merge conflicts detected. Skipping AI resolution."
- name: Resolve conflicts with AI (Bedrock) - name: Resolve conflicts with AI (Bedrock)
if: steps.detect_conflicts.outputs.conflict_files != '' # if: steps.detect_conflicts.outputs.conflict_files != ''
id: ai_resolve id: ai_resolve
run: | run: |
files="${{ steps.detect_conflicts.outputs.conflict_files }}" # files="${{ steps.detect_conflicts.outputs.conflict_files }}"
result_json="{}" # result_json="{}"
for file in $files; do # for file in $files; do
conflict_content=$(cat "$file") # conflict_content=$(cat "$file")
# Send to Bedrock API via curl # Send to Bedrock API via curl
response=$(bash -c "curl -s -X POST https://5xwi3ji63jx6n2c46rn6l7olky0himwz.lambda-url.us-east-1.on.aws \ response=$(bash -c "curl -s -X POST https://5xwi3ji63jx6n2c46rn6l7olky0himwz.lambda-url.us-east-1.on.aws \
@ -59,7 +59,7 @@ jobs:
\"owner\": \"${{ github.repository_owner }}\", \"owner\": \"${{ github.repository_owner }}\",
\"repo_name\": \"${{ github.event.repository.name }}\", \"repo_name\": \"${{ github.event.repository.name }}\",
\"file_path\": \"$file\", \"file_path\": \"$file\",
\"conflict_content\": $(jq -Rs <<< \"$conflict_content\"), # \"conflict_content\": $(jq -Rs <<< \"$conflict_content\"),
\"pr_number\": \"${{ github.event.pull_request.number }}\", \"pr_number\": \"${{ github.event.pull_request.number }}\",
} }
EOF EOF
@ -78,13 +78,13 @@ jobs:
done done
- name: Commit and Push Resolved Files - name: Commit and Push Resolved Files
if: steps.detect_conflicts.outputs.conflict_files != '' # if: steps.detect_conflicts.outputs.conflict_files != ''
run: | run: |
git commit -m "Auto-resolved merge conflicts using AI 🤖" git commit -m "Auto-resolved merge conflicts using AI 🤖"
git push origin HEAD:${{ github.head_ref }} git push origin HEAD:${{ github.head_ref }}
- name: Comment on PR with Confidence Score - name: Comment on PR with Confidence Score
if: steps.detect_conflicts.outputs.conflict_files != '' # if: steps.detect_conflicts.outputs.conflict_files != ''
uses: peter-evans/create-or-update-comment@v4 uses: peter-evans/create-or-update-comment@v4
with: with:
token: ${{ secrets.PAT_TOKEN }} token: ${{ secrets.PAT_TOKEN }}