Skip to content

Add PHPUnit Coverage workflow #49

Add PHPUnit Coverage workflow

Add PHPUnit Coverage workflow #49

name: Coverage Status Check
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
coverage-gate:
name: Coverage Gate
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Wait for coverage check
timeout-minutes: 10
run: |
echo "Waiting for Code Coverage Check to complete..."
# Wait up to 10 minutes for the check to appear and complete
for i in {1..60}; do
# Get the status of the Code Coverage Check
STATUS=$(gh api repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha }}/check-runs \
--jq '.check_runs[] | select(.name == "Code Coverage Check") | .status' || echo "")
CONCLUSION=$(gh api repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha }}/check-runs \
--jq '.check_runs[] | select(.name == "Code Coverage Check") | .conclusion' || echo "")
if [ -n "$STATUS" ]; then
echo "Check found with status: $STATUS, conclusion: $CONCLUSION"
if [ "$STATUS" == "completed" ]; then
if [ "$CONCLUSION" == "success" ]; then
echo "✅ Code coverage check passed!"
exit 0
else
echo "❌ Code coverage check failed with conclusion: $CONCLUSION"
exit 1
fi
fi
else
echo "Check not found yet (attempt $i/60)"
fi
sleep 10
done
echo "❌ Timeout waiting for Code Coverage Check"
exit 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coverage gate passed
run: echo "✅ Code coverage requirements met!"