Skip to content

Conversation

@N6REJ
Copy link
Contributor

@N6REJ N6REJ commented Nov 25, 2025

PR Type

Enhancement


Description

  • Implement comprehensive CI/CD workflow for phpPgAdmin testing

    • Smart version detection from /bin changes, PR title, or latest releases
    • Automated testing on Windows runners with download, extraction, and validation
  • Create release automation workflow for updating releases.properties

  • Add link validation workflow for properties file URLs

  • Provide detailed documentation and quick start guides


Diagram Walkthrough

flowchart LR
  PR["Pull Request"] --> Detect["Detect Versions<br/>/bin, Title, or Latest"]
  Detect --> Test["Test phpPgAdmin<br/>Download, Extract, Verify"]
  Test --> Report["Generate Test Report"]
  Release["New Release"] --> Update["Update releases.properties"]
  Update --> Validate["Validate Links"]
  Validate --> Merge["Auto-merge PR"]
Loading

File Walkthrough

Relevant files
Enhancement
phppgadmin-test.yml
phpPgAdmin automated testing workflow with smart version detection

.github/workflows/phppgadmin-test.yml

  • Implements smart version detection using three-tier strategy (changed
    files in /bin, PR title parsing, latest versions fallback)
  • Automated testing workflow that downloads, extracts, and validates
    phpPgAdmin versions
  • Parallel matrix testing on Windows runners with comprehensive
    verification steps
  • Generates test reports and summaries for each tested version
+467/-0 
Documentation
QUICK_START.md
Quick start guide for CI/CD setup and usage                           

docs/QUICK_START.md

  • Provides 5-minute setup guide for GitHub token configuration and
    workflow permissions
  • Documents three methods for creating pull requests with version
    detection examples
  • Includes manual testing instructions via GitHub Actions UI
  • Offers troubleshooting quick fixes and common task examples
+283/-0 
README.md
Complete CI/CD workflows documentation and reference guide

docs/README.md

  • Comprehensive documentation of three main workflows (test,
    update-releases, validate-links)
  • Detailed explanation of smart version detection strategy with
    flowcharts
  • Setup requirements including required secrets and repository settings
  • Usage examples covering release creation, PR testing, and manual
    testing scenarios
  • Troubleshooting guide and best practices for release and PR management
+395/-0 

@N6REJ N6REJ added the enhancement ✨ Improve program label Nov 25, 2025
@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Token exposure via HTTP

Description: The workflow passes a GitHub token in an Authorization header to Invoke-WebRequest without
restricting token scope or repository targeting, risking leakage of a high-privilege
GH_PAT if the URL is attacker-controlled via releases.properties or PR manipulation; use
GITHUB_TOKEN with least privileges and validate/whitelist host before including the
header.
phppgadmin-test.yml [260-288]

Referred Code
  DOWNLOAD_URL: ${{ steps.get_url.outputs.url }}
  GH_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
run: |
  $url = $env:DOWNLOAD_URL
  $version = "${{ matrix.version }}"
  $filename = "phppgadmin-$version.7z"

  Write-Host "Downloading from: $url"
  Write-Host "Saving to: $filename"

  # Download with authentication for pre-release assets
  $headers = @{
    'Authorization' = "token $env:GH_TOKEN"
    'Accept' = 'application/octet-stream'
  }

  try {
    Invoke-WebRequest -Uri $url -OutFile $filename -Headers $headers -MaximumRetryCount 3

    if (Test-Path $filename) {
      $size = (Get-Item $filename).Length


 ... (clipped 8 lines)
Untrusted download source

Description: The workflow checks out releases.properties from main and trusts its contents to decide
which external URLs to download, enabling a supply chain risk where a malicious URL in
releases.properties could lead to downloading untrusted binaries during CI; enforce
allowed host validation and checksum verification before download.
phppgadmin-test.yml [138-159]

Referred Code
# Check out main branch to read releases.properties
git checkout main -- releases.properties 2>/dev/null || true

if [ -f "releases.properties" ]; then
  # Extract version numbers from releases.properties (skip comments and empty lines)
  # Take the first N versions (file should be sorted with newest first)
  LATEST_VERSIONS=$(grep -v '^#' releases.properties | grep -v '^[[:space:]]*$' | grep '=' | cut -d'=' -f1 | tr -d ' ' | head -n "$TEST_LATEST")

  while IFS= read -r VERSION; do
    if [ -n "$VERSION" ]; then
      VERSIONS+=("$VERSION")
      echo "  ✓ Will test version: $VERSION"
    fi
  done <<< "$LATEST_VERSIONS"

  echo ""
  echo "✅ Will test latest ${#VERSIONS[@]} version(s)"
else
  echo "  ⚠️  releases.properties not found"
  echo "  ❌ Cannot determine versions to test"
  exit 1


 ... (clipped 1 lines)
Insufficient artifact validation

Description: The verification step only checks for presence of PHP tags in a few files and then
proceeds, providing weak validation of downloaded archives which could contain malicious
code that later propagates; add integrity checks (hash/signature) and stricter validation
before marking success.
phppgadmin-test.yml [321-374]

Referred Code
Write-Host "Verifying phpPgAdmin $version structure..."
Write-Host ""

# Find the phppgadmin directory (might be nested)
$phppgadminDir = Get-ChildItem -Path $extractPath -Recurse -Directory -Filter "phppgadmin*" | Select-Object -First 1

if (-not $phppgadminDir) {
  Write-Host "ERROR: phpPgAdmin directory not found in extracted files"
  exit 1
}

Write-Host "Found phpPgAdmin directory: $($phppgadminDir.FullName)"
Write-Host ""

# Check for essential files
$requiredFiles = @(
  "index.php",
  "conf/config.inc.php-dist"
)

$allFilesExist = $true


 ... (clipped 33 lines)
Overprivileged credentials guidance

Description: Documentation instructs creating a broad-scope Personal Access Token with repo and
workflow permissions and storing it as GH_PAT, encouraging use of high-privilege
long-lived tokens instead of short-lived GITHUB_TOKEN, increasing blast radius if leaked
in logs; recommend least-privilege tokens or default GITHUB_TOKEN.
QUICK_START.md [6-16]

Referred Code
Create a Personal Access Token (PAT) with these permissions:
-`repo` - Full control of private repositories
-`workflow` - Update GitHub Action workflows

Add it to repository secrets as `GH_PAT`:

Settings → Secrets and variables → Actions → New repository secret
Name: GH_PAT
Value: ghp_your_token_here

Secret leakage in logs

Description: The workflow retries downloads but does not mask or prevent writing response/error content
that could include token-bearing request details to logs upon failures, potentially
exposing secrets through error messages; ensure headers are not logged and use auth only
for GitHub domains.
phppgadmin-test.yml [271-279]

Referred Code
$headers = @{
  'Authorization' = "token $env:GH_TOKEN"
  'Accept' = 'application/octet-stream'
}

try {
  Invoke-WebRequest -Uri $url -OutFile $filename -Headers $headers -MaximumRetryCount 3

  if (Test-Path $filename) {
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
Limited Auditing: The workflow performs critical actions (version detection, downloads, extraction,
validation) without emitting structured audit logs tied to user identity beyond console
echoes, making reconstruction of actions potentially insufficient.

Referred Code
- name: Detect versions to test
  id: detect
  env:
    PR_TITLE: ${{ github.event.pull_request.title }}
    MANUAL_VERSIONS: ${{ github.event.inputs.versions }}
    TEST_LATEST: ${{ github.event.inputs.test_latest || '5' }}
  run: |
    set -e

    echo "=== Version Detection Strategy ==="
    echo ""

    VERSIONS=()

    # Manual workflow dispatch - use provided versions or test latest
    if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
      if [ -n "$MANUAL_VERSIONS" ]; then
        echo "📝 Manual trigger: Using provided versions"
        IFS=',' read -ra VERSIONS <<< "$MANUAL_VERSIONS"
        # Trim whitespace
        VERSIONS=("${VERSIONS[@]// /}")


 ... (clipped 120 lines)

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Error Handling Gaps: Several steps rely on simple exit on failure or heuristics (e.g., PHP syntax check via
regex, HEAD/GET fallback noted in docs) which may miss edge cases and lack actionable
context or retries beyond downloads.

Referred Code
# Check PHP files syntax (basic check)
Write-Host ""
Write-Host "Checking PHP file syntax..."

$phpFiles = Get-ChildItem -Path $phppgadminDir.FullName -Filter "*.php" -Recurse | Select-Object -First 5

foreach ($phpFile in $phpFiles) {
  $content = Get-Content $phpFile.FullName -Raw
  if ($content -match '<\?php') {
    Write-Host "✓ Valid PHP syntax: $($phpFile.Name)"
  } else {
    Write-Host "⚠ Potential issue: $($phpFile.Name)"
  }
}

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status:
Token Exposure Risk: The quick start shows an example PAT value format and broad 'repo' scope which
could encourage insecure practices; while not logging secrets directly, guidance may lead
to overscoped tokens used in logs.

Referred Code
Add it to repository secrets as `GH_PAT`:

Settings → Secrets and variables → Actions → New repository secret
Name: GH_PAT
Value: ghp_your_token_here

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
URL Trust Assumption: The workflow reads URLs from 'releases.properties' and downloads/extracts
archives without integrity verification (e.g., checksum/signature), relying solely on HTTP
status and thus lacking strong input validation.

Referred Code
- name: Get download URL from releases.properties
  id: get_url
  shell: pwsh
  run: |
    # Check out releases.properties from the PR branch (or current branch for manual runs)
    git checkout ${{ github.event.pull_request.head.sha || github.sha }} -- releases.properties

    $version = "${{ matrix.version }}"
    Write-Host "Looking for version: $version"

    if (-not (Test-Path "releases.properties")) {
      Write-Host "ERROR: releases.properties not found"
      exit 1
    }

    $content = Get-Content "releases.properties"
    $url = ""

    foreach ($line in $content) {
      $line = $line.Trim()
      # Skip comments and empty lines


 ... (clipped 84 lines)

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

qodo-code-review bot commented Nov 25, 2025

CI Feedback 🧐

(Feedback updated until commit 28277ff)

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: Test phpPgAdmin 7.14.4

Failed stage: Verify phpPgAdmin structure [❌]

Failure summary:

The action failed during the verification step because a required file was missing in the extracted
phpPgAdmin 7.14.4 package:
- Found phpPgAdmin directory at
D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4
- Check reported: ✓ Found:
index.php
- Missing required file: conf/config.inc.php-dist
- The script then printed ERROR:
Required files are missing and exited with code 1 (see lines 475–480).

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

121:  28277ffa39d3da23cc49988b9e6ff5c3de276a78
122:  ##[group]Run git fetch origin main:main
123:  �[36;1mgit fetch origin main:main�[0m
124:  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
125:  ##[endgroup]
126:  From https://github.com/Bearsampp/module-phppgadmin
127:  * [new branch]      main       -> main
128:  ##[group]Run # Check out releases.properties from the PR branch (or current branch for manual runs)
129:  �[36;1m# Check out releases.properties from the PR branch (or current branch for manual runs)�[0m
130:  �[36;1mgit checkout 28277ffa39d3da23cc49988b9e6ff5c3de276a78 -- releases.properties�[0m
131:  �[36;1m�[0m
132:  �[36;1m$version = "7.14.4"�[0m
133:  �[36;1mWrite-Host "Looking for version: $version"�[0m
134:  �[36;1m�[0m
135:  �[36;1mif (-not (Test-Path "releases.properties")) {�[0m
136:  �[36;1m  Write-Host "ERROR: releases.properties not found"�[0m
137:  �[36;1m  exit 1�[0m
...

149:  �[36;1m  �[0m
150:  �[36;1m  # Parse property line�[0m
151:  �[36;1m  if ($line -match '^(.+?)\s*=\s*(.+)$') {�[0m
152:  �[36;1m    $key = $matches[1].Trim()�[0m
153:  �[36;1m    $value = $matches[2].Trim()�[0m
154:  �[36;1m    �[0m
155:  �[36;1m    if ($key -eq $version) {�[0m
156:  �[36;1m      $url = $value�[0m
157:  �[36;1m      Write-Host "Found URL: $url"�[0m
158:  �[36;1m      break�[0m
159:  �[36;1m    }�[0m
160:  �[36;1m  }�[0m
161:  �[36;1m}�[0m
162:  �[36;1m�[0m
163:  �[36;1mif ($url -eq "") {�[0m
164:  �[36;1m  Write-Host "ERROR: Version $version not found in releases.properties"�[0m
165:  �[36;1m  Write-Host "Available versions:"�[0m
...

181:  �[36;1mWrite-Host "Saving to: $filename"�[0m
182:  �[36;1m�[0m
183:  �[36;1m# Download with authentication for pre-release assets�[0m
184:  �[36;1m$headers = @{�[0m
185:  �[36;1m  'Authorization' = "token $env:GH_TOKEN"�[0m
186:  �[36;1m  'Accept' = 'application/octet-stream'�[0m
187:  �[36;1m}�[0m
188:  �[36;1m�[0m
189:  �[36;1mtry {�[0m
190:  �[36;1m  Invoke-WebRequest -Uri $url -OutFile $filename -Headers $headers -MaximumRetryCount 3�[0m
191:  �[36;1m  �[0m
192:  �[36;1m  if (Test-Path $filename) {�[0m
193:  �[36;1m    $size = (Get-Item $filename).Length�[0m
194:  �[36;1m    Write-Host "✓ Download successful: $([math]::Round($size/1MB, 2)) MB"�[0m
195:  �[36;1m  } else {�[0m
196:  �[36;1m    Write-Host "ERROR: Download failed - file not found"�[0m
197:  �[36;1m    exit 1�[0m
198:  �[36;1m  }�[0m
199:  �[36;1m} catch {�[0m
200:  �[36;1m  Write-Host "ERROR: Download failed - $($_.Exception.Message)"�[0m
201:  �[36;1m  exit 1�[0m
...

207:  ##[endgroup]
208:  Downloading from: https://github.com/Bearsampp/module-phppgadmin/releases/download/2023.4.20/bearsampp-phppgadmin-7.14.4-2023.4.25.7z
209:  Saving to: phppgadmin-7.14.4.7z
210:  ✓ Download successful: 0.76 MB
211:  ##[group]Run $version = "7.14.4"
212:  �[36;1m$version = "7.14.4"�[0m
213:  �[36;1m$filename = "phppgadmin-$version.7z"�[0m
214:  �[36;1m$extractPath = "test-extract"�[0m
215:  �[36;1m�[0m
216:  �[36;1mWrite-Host "Extracting $filename to $extractPath..."�[0m
217:  �[36;1m�[0m
218:  �[36;1m# Use 7-Zip (pre-installed on GitHub Windows runners)�[0m
219:  �[36;1m& "C:\Program Files\7-Zip\7z.exe" x $filename -o"$extractPath" -y�[0m
220:  �[36;1m�[0m
221:  �[36;1mif ($LASTEXITCODE -ne 0) {�[0m
222:  �[36;1m  Write-Host "ERROR: Extraction failed"�[0m
223:  �[36;1m  exit 1�[0m
...

383:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\portuguese-pt.php
384:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\README
385:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\romanian.php
386:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\russian-utf8.php
387:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\russian.php
388:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\slovak.php
389:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\spanish.php
390:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\swedish.php
391:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\synch
392:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\translations.php
393:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\turkish.php
394:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\lang\ukrainian.php
395:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\libraries\adodb
396:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\libraries\js
397:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\libraries\decorator.inc.php
398:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\libraries\errorhandler.inc.php
399:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\libraries\highlight.php
...

408:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\themes\global.css
409:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\themes\themes.php
410:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\xloadtree\xloadtree2.js
411:  D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4\xloadtree\xtree2.js
412:  ##[group]Run $version = "7.14.4"
413:  �[36;1m$version = "7.14.4"�[0m
414:  �[36;1m$extractPath = "test-extract"�[0m
415:  �[36;1m�[0m
416:  �[36;1mWrite-Host "Verifying phpPgAdmin $version structure..."�[0m
417:  �[36;1mWrite-Host ""�[0m
418:  �[36;1m�[0m
419:  �[36;1m# Find the phppgadmin directory (might be nested)�[0m
420:  �[36;1m$phppgadminDir = Get-ChildItem -Path $extractPath -Recurse -Directory -Filter "phppgadmin*" | Select-Object -First 1�[0m
421:  �[36;1m�[0m
422:  �[36;1mif (-not $phppgadminDir) {�[0m
423:  �[36;1m  Write-Host "ERROR: phpPgAdmin directory not found in extracted files"�[0m
424:  �[36;1m  exit 1�[0m
...

435:  �[36;1m�[0m
436:  �[36;1m$allFilesExist = $true�[0m
437:  �[36;1mforeach ($file in $requiredFiles) {�[0m
438:  �[36;1m  $filePath = Join-Path $phppgadminDir.FullName $file�[0m
439:  �[36;1m  if (Test-Path $filePath) {�[0m
440:  �[36;1m    Write-Host "✓ Found: $file"�[0m
441:  �[36;1m  } else {�[0m
442:  �[36;1m    Write-Host "✗ Missing: $file"�[0m
443:  �[36;1m    $allFilesExist = $false�[0m
444:  �[36;1m  }�[0m
445:  �[36;1m}�[0m
446:  �[36;1m�[0m
447:  �[36;1mWrite-Host ""�[0m
448:  �[36;1m�[0m
449:  �[36;1mif (-not $allFilesExist) {�[0m
450:  �[36;1m  Write-Host "ERROR: Required files are missing"�[0m
451:  �[36;1m  exit 1�[0m
...

464:  �[36;1m  if ($content -match '<\?php') {�[0m
465:  �[36;1m    Write-Host "✓ Valid PHP syntax: $($phpFile.Name)"�[0m
466:  �[36;1m  } else {�[0m
467:  �[36;1m    Write-Host "⚠ Potential issue: $($phpFile.Name)"�[0m
468:  �[36;1m  }�[0m
469:  �[36;1m}�[0m
470:  �[36;1m�[0m
471:  �[36;1mWrite-Host ""�[0m
472:  �[36;1mWrite-Host "✓ phpPgAdmin $version verification complete"�[0m
473:  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
474:  ##[endgroup]
475:  Verifying phpPgAdmin 7.14.4 structure...
476:  Found phpPgAdmin directory: D:\a\module-phppgadmin\module-phppgadmin\test-extract\phppgadmin7.14.4
477:  ✓ Found: index.php
478:  ✗ Missing: conf/config.inc.php-dist
479:  ERROR: Required files are missing
480:  ##[error]Process completed with exit code 1.
481:  ##[group]Run $version = "7.14.4"
482:  �[36;1m$version = "7.14.4"�[0m
483:  �[36;1m$status = if ($?) { "✅ PASSED" } else { "❌ FAILED" }�[0m
484:  �[36;1m�[0m

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
PR is incomplete, missing key workflows

The PR is incomplete as it only delivers one of the three CI/CD workflows
described in the PR description and documentation. The release automation and
link validation workflows are missing from the submitted code.

Examples:

docs/README.md [7-10]
- [Workflows Overview](#workflows-overview)
- [phppgadmin-test.yml](#phppgadmin-testyml)
- [update-releases-properties.yml](#update-releases-propertiesyml)
- [validate-properties-links.yml](#validate-properties-linksyml)
docs/README.md [130-176]
## update-releases-properties.yml

### Purpose
Automatically updates the `releases.properties` file when new releases are published, maintaining a centralized registry of all available phpPgAdmin versions.

### Triggers
- **Release Events**: `prereleased`, `released`, `edited`
- **Manual Dispatch**: Process a specific release tag

### Workflow Steps

 ... (clipped 37 lines)

Solution Walkthrough:

Before:

// PR file structure
.github/
  workflows/
    phppgadmin-test.yml
docs/
  README.md // Describes 3 workflows
  QUICK_START.md // Describes 3 workflows

// Missing files:
// .github/workflows/update-releases-properties.yml
// .github/workflows/validate-properties-links.yml

After:

// Proposed complete file structure
.github/
  workflows/
    phppgadmin-test.yml
    update-releases-properties.yml  // Add this workflow
    validate-properties-links.yml   // Add this workflow
docs/
  README.md // Documentation now matches implementation
  QUICK_START.md // Documentation now matches implementation
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies a critical issue where the PR is incomplete, as it adds documentation for two workflows that are not actually implemented, making the documentation misleading.

High
Possible issue
Implement a genuine PHP syntax check

Replace the superficial PHP tag check with a proper syntax validation using php
-l. This involves adding a step to set up PHP and updating the verification
script to lint all PHP files.

.github/workflows/phppgadmin-test.yml [365-374]

-$phpFiles = Get-ChildItem -Path $phppgadminDir.FullName -Filter "*.php" -Recurse | Select-Object -First 5
+# Add this step before the 'Verify phpPgAdmin structure' step to set up PHP
+- name: Setup PHP
+  uses: shivammathur/setup-php@v2
+  with:
+    php-version: '8.1' # Or any relevant version
 
+# ... then in the 'Verify phpPgAdmin structure' step, replace the existing code with:
+$phpFiles = Get-ChildItem -Path $phppgadminDir.FullName -Filter "*.php" -Recurse
+
+$failedFiles = 0
 foreach ($phpFile in $phpFiles) {
-  $content = Get-Content $phpFile.FullName -Raw
-  if ($content -match '<\?php') {
+  $lintOutput = php -l $phpFile.FullName
+  if ($LASTEXITCODE -eq 0) {
     Write-Host "✓ Valid PHP syntax: $($phpFile.Name)"
   } else {
-    Write-Host "⚠ Potential issue: $($phpFile.Name)"
+    Write-Host "✗ Invalid PHP syntax: $($phpFile.Name)"
+    Write-Host $lintOutput
+    $failedFiles++
   }
 }
 
+if ($failedFiles -gt 0) {
+  Write-Host "ERROR: Found $failedFiles file(s) with invalid PHP syntax."
+  exit 1
+}
+
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that the existing PHP "syntax check" is superficial and replaces it with a genuine linting process (php -l), significantly increasing the reliability and correctness of the test workflow.

Medium
General
Simplify properties file parsing logic

Refactor the PowerShell script to parse releases.properties using the
ConvertFrom-StringData cmdlet instead of a manual loop, improving code
readability and robustness.

.github/workflows/phppgadmin-test.yml [210-255]

 - name: Get download URL from releases.properties
   id: get_url
   shell: pwsh
   run: |
     # Check out releases.properties from the PR branch (or current branch for manual runs)
     git checkout ${{ github.event.pull_request.head.sha || github.sha }} -- releases.properties
     
     $version = "${{ matrix.version }}"
     Write-Host "Looking for version: $version"
     
     if (-not (Test-Path "releases.properties")) {
       Write-Host "ERROR: releases.properties not found"
       exit 1
     }
     
-    $content = Get-Content "releases.properties"
-    $url = ""
+    # Filter out comments and empty lines before parsing
+    $filteredContent = Get-Content "releases.properties" | Where-Object { $_ -notmatch '^\s*#' -and $_ -match '\S' }
+    $properties = $filteredContent | ConvertFrom-StringData -Delimiter '='
     
-    foreach ($line in $content) {
-      $line = $line.Trim()
-      # Skip comments and empty lines
-      if ($line -match '^#' -or $line -eq '') {
-        continue
-      }
-      
-      # Parse property line
-      if ($line -match '^(.+?)\s*=\s*(.+)$') {
-        $key = $matches[1].Trim()
-        $value = $matches[2].Trim()
-        
-        if ($key -eq $version) {
-          $url = $value
-          Write-Host "Found URL: $url"
-          break
-        }
-      }
-    }
+    $url = $properties[$version]
     
-    if ($url -eq "") {
+    if (-not $url) {
       Write-Host "ERROR: Version $version not found in releases.properties"
       Write-Host "Available versions:"
       Get-Content "releases.properties" | Select-String -Pattern '^\s*[0-9]' | ForEach-Object { Write-Host "  $_" }
       exit 1
     }
     
+    Write-Host "Found URL: $url"
     echo "url=$url" >> $env:GITHUB_OUTPUT
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: This is a good refactoring that improves code quality by using the idiomatic PowerShell cmdlet ConvertFrom-StringData, making the script more readable and maintainable.

Low
  • More

@N6REJ N6REJ closed this Nov 25, 2025
@N6REJ N6REJ deleted the ci branch November 25, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ Improve program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants