$ name: Code Quality Gate on: pull_request: branches: [main, develop] jobs: quality-check: runs-on: ubuntu-latest name: Run Code Quality Review steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get changed files id: changed run: | FILES=$(-weight: 500;">git diff --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.jsx' '*.tsx' '*.py' '*.go' '*.rb' | head -20) echo "files=$FILES" >> $GITHUB_OUTPUT - name: Run GetCodeReviews Quality Scan id: review run: | RESPONSE=$(-weight: 500;">curl -s -X POST https://getcodereviews.com/api/review \ -H "Authorization: Bearer ${{ secrets.CODESCAN_API_KEY }}" \ -H "Content-Type: application/json" \ -d "{ \"repo\": \"${{ github.repository }}\", \"pr_number\": ${{ github.event.pull_request.number }}, \"files\": \"${{ steps.changed.outputs.files }}\" }") SCORE=$(echo $RESPONSE | jq -r '.score') echo "score=$SCORE" >> $GITHUB_OUTPUT echo "## Code Quality Report" >> $GITHUB_STEP_SUMMARY echo "**Score: $SCORE / 100**" >> $GITHUB_STEP_SUMMARY echo "$RESPONSE" | jq -r '.summary' >> $GITHUB_STEP_SUMMARY - name: Enforce Quality Gate run: | SCORE=${{ steps.review.outputs.score }} MINIMUM=70 if [ "$SCORE" -lt "$MINIMUM" ]; then echo "❌ Quality gate failed. Score: $SCORE (minimum: $MINIMUM)" exit 1 else echo "✅ Quality gate passed. Score: $SCORE" fi
name: Code Quality Gate on: pull_request: branches: [main, develop] jobs: quality-check: runs-on: ubuntu-latest name: Run Code Quality Review steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get changed files id: changed run: | FILES=$(-weight: 500;">git diff --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.jsx' '*.tsx' '*.py' '*.go' '*.rb' | head -20) echo "files=$FILES" >> $GITHUB_OUTPUT - name: Run GetCodeReviews Quality Scan id: review run: | RESPONSE=$(-weight: 500;">curl -s -X POST https://getcodereviews.com/api/review \ -H "Authorization: Bearer ${{ secrets.CODESCAN_API_KEY }}" \ -H "Content-Type: application/json" \ -d "{ \"repo\": \"${{ github.repository }}\", \"pr_number\": ${{ github.event.pull_request.number }}, \"files\": \"${{ steps.changed.outputs.files }}\" }") SCORE=$(echo $RESPONSE | jq -r '.score') echo "score=$SCORE" >> $GITHUB_OUTPUT echo "## Code Quality Report" >> $GITHUB_STEP_SUMMARY echo "**Score: $SCORE / 100**" >> $GITHUB_STEP_SUMMARY echo "$RESPONSE" | jq -r '.summary' >> $GITHUB_STEP_SUMMARY - name: Enforce Quality Gate run: | SCORE=${{ steps.review.outputs.score }} MINIMUM=70 if [ "$SCORE" -lt "$MINIMUM" ]; then echo "❌ Quality gate failed. Score: $SCORE (minimum: $MINIMUM)" exit 1 else echo "✅ Quality gate passed. Score: $SCORE" fi
name: Code Quality Gate on: pull_request: branches: [main, develop] jobs: quality-check: runs-on: ubuntu-latest name: Run Code Quality Review steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get changed files id: changed run: | FILES=$(-weight: 500;">git diff --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.jsx' '*.tsx' '*.py' '*.go' '*.rb' | head -20) echo "files=$FILES" >> $GITHUB_OUTPUT - name: Run GetCodeReviews Quality Scan id: review run: | RESPONSE=$(-weight: 500;">curl -s -X POST https://getcodereviews.com/api/review \ -H "Authorization: Bearer ${{ secrets.CODESCAN_API_KEY }}" \ -H "Content-Type: application/json" \ -d "{ \"repo\": \"${{ github.repository }}\", \"pr_number\": ${{ github.event.pull_request.number }}, \"files\": \"${{ steps.changed.outputs.files }}\" }") SCORE=$(echo $RESPONSE | jq -r '.score') echo "score=$SCORE" >> $GITHUB_OUTPUT echo "## Code Quality Report" >> $GITHUB_STEP_SUMMARY echo "**Score: $SCORE / 100**" >> $GITHUB_STEP_SUMMARY echo "$RESPONSE" | jq -r '.summary' >> $GITHUB_STEP_SUMMARY - name: Enforce Quality Gate run: | SCORE=${{ steps.review.outputs.score }} MINIMUM=70 if [ "$SCORE" -lt "$MINIMUM" ]; then echo "❌ Quality gate failed. Score: $SCORE (minimum: $MINIMUM)" exit 1 else echo "✅ Quality gate passed. Score: $SCORE" fi - Name: CODESCAN_API_KEY
- Value: Paste your API key from Step 1