Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
branches: [main]
paths:
- 'action.yml'
- 'scripts/**'
- 'tests/**'
- '.github/workflows/e2e-test.yml'

permissions:
Expand Down Expand Up @@ -49,8 +51,8 @@ jobs:
echo ""

# Validate outputs are not empty
if [ -z "${{ steps.test-basic.outputs.grade }}" ]; then
echo "::error::Grade output is empty"
if [[ ! "${{ steps.test-basic.outputs.grade }}" =~ ^[A-F]$ ]]; then
echo "::error::Grade output is invalid"
exit 1
fi

Expand Down Expand Up @@ -135,7 +137,7 @@ jobs:
git add .
git commit -m "Initial commit with poor code"

- name: Run with strict thresholds (should NOT fail - no push event)
- name: Run with strict thresholds (may fail)
uses: ./
id: test-strict
with:
Expand All @@ -151,15 +153,16 @@ jobs:
echo "Grade: ${{ steps.test-strict.outputs.grade }}"
echo ""

# On pull_request, thresholds should NOT cause failure
# (thresholds only enforced on push events)
echo "✅ Threshold behavior validated (metrics reported, no CI failure)"
if [ "${{ steps.test-strict.outcome }}" != "failure" ]; then
echo "::error::Strict threshold unexpectedly passed"
exit 1
fi

echo "### 🛡️ Threshold Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Grade:** ${{ steps.test-strict.outputs.grade }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Thresholds validated (show metrics without failing on non-push)" >> $GITHUB_STEP_SUMMARY
echo "Threshold outcome: ${{ steps.test-strict.outcome }}" >> $GITHUB_STEP_SUMMARY

test-pr-comment:
name: Test PR Comment Creation
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Test Action

# This workflow is workflow_dispatch-only to avoid running on every change in this repository.
# Enable push/PR triggers in forks if you want continuous validation.
on:
pull_request:
workflow_dispatch:

jobs:
Expand All @@ -20,6 +19,10 @@ jobs:
steps:
- name: Checkout action code
uses: actions/checkout@v4

- name: Check analysis and threshold scripts
shell: bash
run: bash tests/test-action.sh

- name: Create test repository
shell: bash
Expand Down Expand Up @@ -59,8 +62,8 @@ jobs:
echo "Onboarding: ${{ steps.test-basic.outputs.onboarding }}"
echo "Health: ${{ steps.test-basic.outputs.health }}"

if [ -z "${{ steps.test-basic.outputs.grade }}" ]; then
echo "::error::Grade output is empty"
if [[ ! "${{ steps.test-basic.outputs.grade }}" =~ ^[A-F]$ ]]; then
echo "::error::Grade output is invalid"
exit 1
fi

Expand All @@ -73,7 +76,6 @@ jobs:
fail-under: F
max-risk: High
max-onboarding: Hard
continue-on-error: true

- name: Report test results
if: always()
Expand Down
Loading
Loading