Skip to content

build: Psl auto pr review2 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/pr-reviewer-bot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"model": "gpt-4",
"commentMode": "multi",
"language": "en",
"filesToIgnore": [
"**/*.md",
"**/*.yml",
"**/*.json",
"**/__pycache__/**",
"**/*.lock"
],
"rules": [
{
"name": "No TODOs in code",
"description": "Prevent merging PRs with TODO comments left in code.",
"pattern": "TODO",
"failOnMatch": true
},
{
"name": "Avoid console/debug prints",
"description": "Remove print/debug/log statements before committing.",
"pattern": "console\\.log|print\\(|debugger;",
"failOnMatch": true
},
{
"name": "Require tests for Python changes",
"description": "Changes to backend Python code should include tests.",
"pathPattern": "backend/**/*.py",
"requireMatchingTest": true
},
{
"name": "Require tests for React components",
"description": "Ensure that React component changes include test coverage.",
"pathPattern": "frontend/src/components/**/*.tsx?",
"requireMatchingTest": true
},
{
"name": "Avoid hardcoded secrets or keys",
"description": "Scan for obvious secret patterns in code.",
"pattern": "(api[_-]?key|secret|password)\\s*[:=]\\s*[\"'].*[\"']",
"failOnMatch": true
}
]
}

35 changes: 35 additions & 0 deletions .github/workflows/auto-pr-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Auto PR Review

on: [pull_request]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: omio-labs/pr-reviewer-bot@v1
with:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}



# on:
# pull_request:
# types: [opened, edited, synchronize]

# jobs:
# review:
# runs-on: ubuntu-latest

# steps:
# - name: Checkout PR code
# uses: actions/checkout@v3

# - name: Run Auto PR Review
# uses: tianhaoz95/auto-pr-review@v0.0.9
# with:
# github-token: ${{ secrets.GIT_TOKEN }}
# I need to create new token for this repo and add it to secrets, cannot use the default GITHUB_TOKEN.
# because this token does not have permission to post reviews for PRs
Comment on lines +18 to +35
Copy link
Preview

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing the commented-out workflow configuration if it is no longer needed to enhance clarity and maintainability.

Suggested change
# on:
# pull_request:
# types: [opened, edited, synchronize]
# jobs:
# review:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout PR code
# uses: actions/checkout@v3
# - name: Run Auto PR Review
# uses: tianhaoz95/auto-pr-review@v0.0.9
# with:
# github-token: ${{ secrets.GIT_TOKEN }}
# I need to create new token for this repo and add it to secrets, cannot use the default GITHUB_TOKEN.
# because this token does not have permission to post reviews for PRs
# (Commented-out workflow configuration removed for clarity and maintainability)

Copilot uses AI. Check for mistakes.

8 changes: 4 additions & 4 deletions .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
file: ./src/WebApp.Dockerfile
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }}
tags: |
${{ steps.registry.outputs.int_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.int_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ steps.registry.outputs.int_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.int_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
Comment on lines +79 to +80
Copy link
Preview

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the slash between the registry and the image name may result in an invalid Docker tag format. Consider restoring the slash (/) to correctly construct the tag.

Suggested change
${{ steps.registry.outputs.int_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.int_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ steps.registry.outputs.int_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.int_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}

Copilot uses AI. Check for mistakes.

Comment on lines +79 to +80
Copy link
Preview

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker image tag strings now have a space instead of a forward slash between the registry URL and the image name, which could result in incorrect image tagging. Consider restoring the forward slash (/) between these components.

Suggested change
${{ steps.registry.outputs.int_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.int_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ steps.registry.outputs.int_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.int_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}

Copilot uses AI. Check for mistakes.


- name: Build Docker Image and optionally push - External Registry
if: ${{ github.ref_name == 'main' }}
Expand All @@ -87,6 +87,6 @@ jobs:
file: ./src/WebApp.Dockerfile
push: ${{github.ref_name == 'main' }}
tags: |
${{ steps.registry.outputs.ext_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.ext_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ steps.registry.outputs.ext_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.ext_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
Comment on lines +90 to +91
Copy link
Preview

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing slash between the external registry and the image name could produce an improperly formatted Docker tag. Inserting a slash (/) between the registry and the image name should resolve this.

Suggested change
${{ steps.registry.outputs.ext_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.ext_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ steps.registry.outputs.ext_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.ext_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}

Copilot uses AI. Check for mistakes.

Comment on lines +90 to +91
Copy link
Preview

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tag for the external registry image appears to be missing the slash separator between the registry URL and the image name. Adding a '/' should correctly format the Docker tag.

Suggested change
${{ steps.registry.outputs.ext_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.ext_registry }} webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}
${{ steps.registry.outputs.ext_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
${{ steps.registry.outputs.ext_registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}

Copilot uses AI. Check for mistakes.


Loading