Irving armenta patch 1 #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: File Changes Summary using Deepseek AI | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
file-changes-summary: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate file changes summary | |
env: | |
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} | |
run: | | |
git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} | |
git diff --name-status origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }} > file_changes_summary.txt | |
curl -X POST "https://api.deepseek.ai/analyze" \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \ | |
-d @file_changes_summary.txt > deepseek_summary.json | |
- name: Create Markdown summary | |
run: | | |
echo "### File Changes Summary (Generated by Deepseek AI)" > summary.md | |
cat deepseek_summary.json >> summary.md | |
- name: Post summary to PR comment | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
COMMENT_BODY=$(cat summary.md) | |
COMMENT_URL=$(jq -r .pull_request.comments_url ${GITHUB_EVENT_PATH}) | |
curl -H "Authorization: token $GITHUB_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"body\":\"${COMMENT_BODY}\"}" \ | |
$COMMENT_URL |