Skip to content

Commit 9aa6a62

Browse files
authored
Merge pull request #34 from seanmac5291/copilot/fix-33
Fix critical accessibility workflow errors - missing artifacts upload and dependencies
2 parents 805c9f8 + 178cc60 commit 9aa6a62

File tree

1 file changed

+74
-4
lines changed

1 file changed

+74
-4
lines changed

.github/workflows/unified-accessibility.yml

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ jobs:
7878
7979
# Install yq if not available
8080
if ! command -v yq &> /dev/null; then
81-
sudo snap install yq --classic || echo "yq installation failed, using defaults"
81+
echo "Installing yq..."
82+
wget -qO /tmp/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
83+
sudo chmod +x /tmp/yq
84+
sudo mv /tmp/yq /usr/local/bin/yq || echo "yq installation failed, using defaults"
8285
fi
8386
8487
# Override target URL based on environment
@@ -568,6 +571,12 @@ jobs:
568571
# Run the enhanced test with ES modules
569572
TARGET_URL="${{ needs.setup.outputs.target-url }}" REPORT_DIR="${{ env.REPORT_DIR }}" node enhanced-screenreader-test.mjs || echo "Enhanced screen reader test completed with issues"
570573
574+
- name: Install required dependencies
575+
run: |
576+
echo "Installing required system dependencies..."
577+
sudo apt-get update -qq
578+
sudo apt-get install -y bc jq
579+
571580
- name: Generate comprehensive accessibility report
572581
id: quality_gate_check # Added id
573582
run: |
@@ -669,9 +678,54 @@ jobs:
669678
}
670679
EOF
671680
672-
# Create detailed HTML report (existing logic)
673-
# ... (ensure variables like {{TOTAL_ISSUES}}, {{AXCORE_ISSUES}}, {{LIGHTHOUSE_SCORE}} are correctly substituted if this is a template)
674-
# This part of the script was truncated in the provided context, but assuming it uses the calculated vars.
681+
# Create a simple HTML dashboard report
682+
cat > ${{ env.REPORT_DIR }}/accessibility-dashboard.html << 'EOF'
683+
<!DOCTYPE html>
684+
<html lang="en">
685+
<head>
686+
<meta charset="UTF-8">
687+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
688+
<title>Accessibility Scan Results</title>
689+
<style>
690+
body { font-family: Arial, sans-serif; margin: 20px; }
691+
.summary { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }
692+
.pass { color: green; } .fail { color: red; } .warn { color: orange; }
693+
table { border-collapse: collapse; width: 100%; }
694+
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
695+
th { background-color: #f2f2f2; }
696+
</style>
697+
</head>
698+
<body>
699+
<h1>🔍 Accessibility Scan Results</h1>
700+
<div class="summary">
701+
<h2>Summary</h2>
702+
<p><strong>Total Issues:</strong> <span class="$([ $TOTAL_ISSUES -eq 0 ] && echo 'pass' || echo 'fail')">$TOTAL_ISSUES</span></p>
703+
<p><strong>Scan Date:</strong> $(date)</p>
704+
<p><strong>Target URL:</strong> ${{ needs.setup.outputs.target-url }}</p>
705+
</div>
706+
707+
<h2>📊 Tool Results</h2>
708+
<table>
709+
<tr><th>Tool</th><th>Issues Found</th><th>Status</th></tr>
710+
<tr><td>Axe-core</td><td>$AXCORE_ISSUES</td><td class="$([ $AXCORE_ISSUES -eq 0 ] && echo 'pass' || echo 'fail')">$([ $AXCORE_ISSUES -eq 0 ] && echo 'PASS' || echo 'FAIL')</td></tr>
711+
<tr><td>Pa11y</td><td>$PA11Y_ISSUES</td><td class="$([ $PA11Y_ISSUES -eq 0 ] && echo 'pass' || echo 'fail')">$([ $PA11Y_ISSUES -eq 0 ] && echo 'PASS' || echo 'FAIL')</td></tr>
712+
<tr><td>Keyboard Navigation</td><td>$KEYBOARD_ISSUES</td><td class="$([ $KEYBOARD_ISSUES -eq 0 ] && echo 'pass' || echo 'fail')">$([ $KEYBOARD_ISSUES -eq 0 ] && echo 'PASS' || echo 'FAIL')</td></tr>
713+
<tr><td>Screen Reader</td><td>$SCREENREADER_ISSUES</td><td class="$([ $SCREENREADER_ISSUES -eq 0 ] && echo 'pass' || echo 'fail')">$([ $SCREENREADER_ISSUES -eq 0 ] && echo 'PASS' || echo 'FAIL')</td></tr>
714+
<tr><td>Lighthouse Desktop</td><td>Score: $LIGHTHOUSE_DESKTOP_SCORE%</td><td class="$([ $LIGHTHOUSE_DESKTOP_SCORE -ge 90 ] && echo 'pass' || echo 'warn')">$([ $LIGHTHOUSE_DESKTOP_SCORE -ge 90 ] && echo 'GOOD' || echo 'NEEDS WORK')</td></tr>
715+
<tr><td>Lighthouse Mobile</td><td>Score: $LIGHTHOUSE_MOBILE_SCORE%</td><td class="$([ $LIGHTHOUSE_MOBILE_SCORE -ge 90 ] && echo 'pass' || echo 'warn')">$([ $LIGHTHOUSE_MOBILE_SCORE -ge 90 ] && echo 'GOOD' || echo 'NEEDS WORK')</td></tr>
716+
</table>
717+
718+
<h2>📋 Report Files</h2>
719+
<ul>
720+
<li><a href="axe-report.json">Axe-core Report</a></li>
721+
<li><a href="pa11y-report.json">Pa11y Report</a></li>
722+
<li><a href="lighthouse-accessibility-desktop.json">Lighthouse Desktop</a></li>
723+
<li><a href="lighthouse-accessibility-mobile.json">Lighthouse Mobile</a></li>
724+
<li><a href="executive-summary.json">Executive Summary</a></li>
725+
</ul>
726+
</body>
727+
</html>
728+
EOF
675729
676730
# GitHub Step Summary Generation
677731
echo "# 🔍 Unified Accessibility Scan Results" >> $GITHUB_STEP_SUMMARY
@@ -754,6 +808,14 @@ jobs:
754808
echo "total-issues=${TOTAL_ISSUES}" >> $GITHUB_OUTPUT
755809
echo "critical-issues=${TOTAL_CRITICAL_ISSUES_NUMERIC}" >> $GITHUB_OUTPUT
756810
811+
- name: Upload accessibility reports
812+
uses: actions/upload-artifact@v4
813+
if: always()
814+
with:
815+
name: unified-accessibility-evaluation
816+
path: ${{ env.REPORT_DIR }}
817+
retention-days: 30
818+
757819
- name: Fail workflow if quality gates failed and configured to fail
758820
if: needs.setup.outputs.fail-on-issues == 'true' && steps.quality_gate_check.outputs.passed == 'false' # Changed steps.quality-gates to steps.quality_gate_check
759821
run: |
@@ -769,6 +831,8 @@ jobs:
769831
runs-on: ubuntu-latest
770832
needs: [setup, accessibility-scan]
771833
if: github.event_name == 'pull_request'
834+
env:
835+
REPORT_DIR: 'accessibility-reports'
772836
permissions:
773837
pull-requests: write
774838
steps:
@@ -778,6 +842,12 @@ jobs:
778842
name: unified-accessibility-evaluation
779843
path: ${{ env.REPORT_DIR }}
780844

845+
- name: Install required dependencies
846+
run: |
847+
echo "Installing required dependencies for PR comment generation..."
848+
sudo apt-get update -qq
849+
sudo apt-get install -y bc jq
850+
781851
- name: Generate PR comment
782852
run: |
783853
# Calculate results

0 commit comments

Comments
 (0)