From 09ec620be742a3749a7221c7b113512b055aa497 Mon Sep 17 00:00:00 2001 From: Ualerson Date: Sat, 27 Sep 2025 17:37:59 -0300 Subject: [PATCH 1/2] pr workflow fix --- .github/workflows/pr.yml | 18 ++++++++++++------ Back-End/Workflows/PullRequest/pr.yml | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c8b787f5..9b387bfe 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -8,15 +8,21 @@ jobs: call-external-service: runs-on: ubuntu-latest steps: + - name: Debug JSON + run: | + echo "Repository: ${{ github.repository }}" + echo "PR number: ${{ github.event.pull_request.number }}" + echo "Email: ${{ secrets.email }}" + - name: Chamar API PR AI run: | curl -X POST \ -H "Content-Type: application/json" \ -H "X-API-TOKEN: ${{ secrets.PRAI_API_TOKEN }}" \ - -d '{ - "repository": "${{ github.repository }}", - "pr_number": ${{ github.event.pull_request.number }}, - "email": ${{ secrets.email }}, - "password": "${{ secrets.password }}", - }' \ + -d "{ + \"repository\": \"${{ github.repository }}\", + \"pr_number\": \"${{ github.event.pull_request.number }}\", + \"email\": \"${{ secrets.email }}\", + \"password\": \"${{ secrets.password }}\" + }" \ https://api.softwareai.site/api/prai/gen diff --git a/Back-End/Workflows/PullRequest/pr.yml b/Back-End/Workflows/PullRequest/pr.yml index c8b787f5..9b387bfe 100644 --- a/Back-End/Workflows/PullRequest/pr.yml +++ b/Back-End/Workflows/PullRequest/pr.yml @@ -8,15 +8,21 @@ jobs: call-external-service: runs-on: ubuntu-latest steps: + - name: Debug JSON + run: | + echo "Repository: ${{ github.repository }}" + echo "PR number: ${{ github.event.pull_request.number }}" + echo "Email: ${{ secrets.email }}" + - name: Chamar API PR AI run: | curl -X POST \ -H "Content-Type: application/json" \ -H "X-API-TOKEN: ${{ secrets.PRAI_API_TOKEN }}" \ - -d '{ - "repository": "${{ github.repository }}", - "pr_number": ${{ github.event.pull_request.number }}, - "email": ${{ secrets.email }}, - "password": "${{ secrets.password }}", - }' \ + -d "{ + \"repository\": \"${{ github.repository }}\", + \"pr_number\": \"${{ github.event.pull_request.number }}\", + \"email\": \"${{ secrets.email }}\", + \"password\": \"${{ secrets.password }}\" + }" \ https://api.softwareai.site/api/prai/gen From fc4d741f7e0524a081b701c4e161a828ba37cb1c Mon Sep 17 00:00:00 2001 From: Ualerson Date: Sat, 27 Sep 2025 17:44:02 -0300 Subject: [PATCH 2/2] fix cors --- Back-End/api.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Back-End/api.py b/Back-End/api.py index 5cca2b98..d9a0338e 100644 --- a/Back-End/api.py +++ b/Back-End/api.py @@ -65,11 +65,13 @@ default_limits=[] ) -CORS(app, resources={ - r"/api/*": { - "origins": os.getenv('FRONTEND_ORIGINS', '*').split(',') - } -}) + +if os.getenv("FLASK_ENV") == "development": + CORS(app, resources={ + r"/api/*": { + "origins": os.getenv('FRONTEND_ORIGINS', '*').split(',') + } + }) db.init_app(app) @app.route('/')