From ad8fe36d099175f85baf716912d636da3bcc1e3f Mon Sep 17 00:00:00 2001 From: Focused Bytes Date: Mon, 16 Jun 2025 08:53:14 +0300 Subject: [PATCH 1/3] Fix errors in GitHub Actions Workflow script --- .../Code_quality_and_security_scan_with_GitHub_Actions.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/third_party/Code_quality_and_security_scan_with_GitHub_Actions.md b/examples/third_party/Code_quality_and_security_scan_with_GitHub_Actions.md index 8cd8baf5f3..1a6ebd7354 100644 --- a/examples/third_party/Code_quality_and_security_scan_with_GitHub_Actions.md +++ b/examples/third_party/Code_quality_and_security_scan_with_GitHub_Actions.md @@ -98,6 +98,7 @@ jobs: if [ -f original_files_temp.json ]; then jq -s '.[0] * .[1]' diff.json original_files_temp.json > combined.json mv combined.json diff.json + fi - name: Display Processed Diff (Debug) run: cat diff.json @@ -105,12 +106,13 @@ jobs: - name: Analyze with OpenAI env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + MODELNAME: ${{ vars.MODELNAME }} run: | DIFF_CONTENT=$(jq -r '.diff' diff.json) ORIGINAL_FILES=$(jq -r '."original files"' diff.json) PROMPT="Please review the following code changes for any obvious quality or security issues. Provide a brief report in markdown format:\n\nDIFF:\n${DIFF_CONTENT}\n\nORIGINAL FILES:\n${ORIGINAL_FILES}" - jq -n --arg prompt "$PROMPT" '{ - "model": "gpt-4", + jq -n --arg model "$MODELNAME" --arg prompt "$PROMPT" '{ + "model": "\($model)", "messages": [ { "role": "system", "content": "You are a code reviewer." }, { "role": "user", "content": $prompt } @@ -257,4 +259,4 @@ Commit this workflow to your repository, then open a new PR. The workflow will r ![pr_quality_and_security_check.png](../../images/pr_quality_and_security_check.png) -![workflow_check.png](../../images/workflow_check.png) \ No newline at end of file +![workflow_check.png](../../images/workflow_check.png) From 39ddde3a5cc36eed18cf1bede6d133cd680ad059 Mon Sep 17 00:00:00 2001 From: Focused Bytes Date: Mon, 16 Jun 2025 09:09:50 +0300 Subject: [PATCH 2/3] Test code review --- examples/bad_example.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 examples/bad_example.py diff --git a/examples/bad_example.py b/examples/bad_example.py new file mode 100644 index 0000000000..1c914f81cd --- /dev/null +++ b/examples/bad_example.py @@ -0,0 +1,16 @@ +def run(): + code = "print('Hello World')" + eval(code) + + user_input = input("Enter a number: ") + try: + result = int(user_input) / 0 + print( result ) + except: + print("something went wrong") + + temp = [] + for i in range(0,10): + temp.append(i) + for i in range(0,10): + temp.append(i) From d91d45f09a743e5265af0a73194e2802c2c7ecf7 Mon Sep 17 00:00:00 2001 From: Focused Bytes Date: Mon, 16 Jun 2025 09:21:01 +0300 Subject: [PATCH 3/3] Next change --- examples/bad_example.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/bad_example.py b/examples/bad_example.py index 1c914f81cd..67b5e57f78 100644 --- a/examples/bad_example.py +++ b/examples/bad_example.py @@ -14,3 +14,6 @@ def run(): temp.append(i) for i in range(0,10): temp.append(i) + + +