Browse Source

fix: Add working admin bypass for validation workflow (#111)

- Implement skip_validation flag that actually works
- Admin can now bypass validation with: gh workflow run "Validate Registry on PR" -f pr_number=106 -f skip_validation=true
- Workflow exits successfully when bypassed
- Unblocks stuck bot PRs immediately
Darren Hinde 6 months ago
parent
commit
254c8bf6db
1 changed files with 12 additions and 2 deletions
  1. 12 2
      .github/workflows/validate-registry.yml

+ 12 - 2
.github/workflows/validate-registry.yml

@@ -44,15 +44,24 @@ jobs:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     
     
     steps:
     steps:
+      - name: Admin bypass check
+        if: github.event_name == 'workflow_dispatch' && github.event.inputs.skip_validation == 'true'
+        run: |
+          echo "## ✅ Validation Bypassed (Admin Override)" >> $GITHUB_STEP_SUMMARY
+          echo "" >> $GITHUB_STEP_SUMMARY
+          echo "Validation checks skipped by maintainer." >> $GITHUB_STEP_SUMMARY
+          echo "PR: #${{ github.event.inputs.pr_number }}" >> $GITHUB_STEP_SUMMARY
+          exit 0
+      
       - name: Checkout repository (for manual runs)
       - name: Checkout repository (for manual runs)
-        if: github.event_name == 'workflow_dispatch'
+        if: github.event_name == 'workflow_dispatch' && github.event.inputs.skip_validation != 'true'
         uses: actions/checkout@v4
         uses: actions/checkout@v4
         with:
         with:
           fetch-depth: 0
           fetch-depth: 0
           token: ${{ secrets.GITHUB_TOKEN }}
           token: ${{ secrets.GITHUB_TOKEN }}
       
       
       - name: Get PR details (for manual runs)
       - name: Get PR details (for manual runs)
-        if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != ''
+        if: github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number != '' && github.event.inputs.skip_validation != 'true'
         id: get_pr
         id: get_pr
         run: |
         run: |
           PR_DATA=$(gh pr view ${{ github.event.inputs.pr_number }} --json headRefName,headRepository,headRepositoryOwner)
           PR_DATA=$(gh pr view ${{ github.event.inputs.pr_number }} --json headRefName,headRepository,headRepositoryOwner)
@@ -62,6 +71,7 @@ jobs:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
       
       
       - name: Checkout PR branch
       - name: Checkout PR branch
+        if: github.event.inputs.skip_validation != 'true'
         uses: actions/checkout@v4
         uses: actions/checkout@v4
         with:
         with:
           # For manual runs: use PR details from get_pr step
           # For manual runs: use PR details from get_pr step