fix: simplified workflow syntax

This commit is contained in:
Shaun Arman 2026-04-10 14:59:41 -05:00 committed by Shaun Arman
parent 98a0f908d7
commit 63a055d4fe

View File

@ -6,23 +6,21 @@ on:
jobs: jobs:
review: review:
runs-on: self-hosted runs-on: ubuntu-latest
container: container:
image: ubuntu:22.04 image: ubuntu:22.04
steps: steps:
- name: Install dependencies - name: Install dependencies
run: | run: |
apt-get update && apt-get install -y \ set -eux
git \ apt-get update -qq && apt-get install -y -qq git curl jq
curl \
jq \
&& rm -rf /var/lib/apt/lists/*
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 run: |
with: git init
token: ${{ secrets.TFT_GITEA_TOKEN }} git remote add origin http://172.0.0.29:3000/sarman/tftsr-devops_investigation.git
ref: ${{ github.head_ref }} git fetch --depth=1 origin ${{ github.head_ref }}
git checkout FETCH_HEAD
- name: Get PR diff - name: Get PR diff
id: diff id: diff
@ -38,21 +36,8 @@ jobs:
API_KEY: ${{ secrets.OLLAMA_API_KEY }} API_KEY: ${{ secrets.OLLAMA_API_KEY }}
run: | run: |
DIFF_CONTENT=$(cat /tmp/pr_diff.txt) DIFF_CONTENT=$(cat /tmp/pr_diff.txt)
PROMPT="Analyze the following code changes for completion, completeness, correctness, security issues, and best practices. PROMPT="Analyze the following code changes for completion, completeness, correctness, security issues, and best practices. PR Title: ${{ github.event.pull_request.title }}. Diff: $DIFF_CONTENT. Provide review with: 1) Completion check, 2) Completeness check, 3) Bugs/errors, 4) Security issues, 5) Best practices. Then give specific comments with suggested fixes."
RESPONSE=$(curl -s -X POST "$OLLAMA_URL/chat" -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d "{\"model\":\"qwen3-coder-next:latest\",\"messages\":[{\"role\":\"user\",\"content\":\"$PROMPT\"}],\"stream\":false}")
PR Title: ${{ github.event.pull_request.title }}
Diff:
$DIFF_CONTENT
Provide review with: 1) Completion check, 2) Completeness check, 3) Bugs/errors, 4) Security issues, 5) Best practices.
Then give specific comments with suggested fixes."
RESPONSE=$(curl -s -X POST "$OLLAMA_URL/chat" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\":\"qwen3-coder-next:latest\",\"messages\":[{\"role\":\"user\",\"content\":\"$PROMPT\"}],\"stream\":false}")
echo "$RESPONSE" > /tmp/ollama_response.json echo "$RESPONSE" > /tmp/ollama_response.json
REVIEW=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // empty') REVIEW=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // empty')
echo "$REVIEW" > /tmp/pr_review.txt echo "$REVIEW" > /tmp/pr_review.txt
@ -65,8 +50,5 @@ jobs:
run: | run: |
if [ -f "/tmp/pr_review.txt" ] && [ -s "/tmp/pr_review.txt" ]; then if [ -f "/tmp/pr_review.txt" ] && [ -s "/tmp/pr_review.txt" ]; then
REVIEW_BODY=$(cat /tmp/pr_review.txt | head -c 65536) REVIEW_BODY=$(cat /tmp/pr_review.txt | head -c 65536)
curl -s -X POST "http://172.0.0.29:3000/api/v1/repos/sarman/tftsr-devops_investigation/pulls/$PR_NUMBER/reviews" \ curl -s -X POST "http://172.0.0.29:3000/api/v1/repos/sarman/tftsr-devops_investigation/pulls/$PR_NUMBER/reviews" -H "Authorization: token $TF_TOKEN" -H "Content-Type: application/json" -d "{\"body\": \"🤖 Automated PR Review:\n\n$REVIEW_BODY\n\n---\n*this is an automated review from Ollama*\", \"event\": \"COMMENT\"}"
-H "Authorization: token $TF_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"body\": \"🤖 Automated PR Review:\n\n$REVIEW_BODY\n\n---\n*this is an automated review from Ollama*\", \"event\": \"COMMENT\"}"
fi fi