Browse Source

fix: Enable manual validation workflow for bot-created PRs (#109)

* fix: Add repository checkout before getting PR details in manual workflow runs

- Fixes 'fatal: not a git repository' error when manually triggering validate-registry workflow
- Adds initial checkout step for workflow_dispatch events before gh pr view command
- Allows manual validation of bot-created PRs (version bumps, doc syncs)
- Resolves issue preventing PR #106 from being merged

* fix: Use pull_request_target to allow workflow on bot PRs

- Add pull_request_target trigger to validate-registry workflow
- Allows workflow to run automatically on bot-created PRs (version bumps, doc syncs)
- Fixes issue where PR #106 and similar bot PRs are blocked
- pull_request_target runs with base branch permissions, safe for bot PRs
Darren Hinde 2 months ago
parent
commit
f03ad4523a
1 changed files with 12 additions and 0 deletions
  1. 12 0
      .github/workflows/validate-registry.yml

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

@@ -18,6 +18,11 @@ on:
       - dev
       - dev
     # Removed paths filter - this check is required by repository ruleset
     # Removed paths filter - this check is required by repository ruleset
     # so it must run on ALL PRs to prevent blocking merges
     # so it must run on ALL PRs to prevent blocking merges
+  pull_request_target:
+    branches:
+      - main
+      - dev
+    # pull_request_target allows workflows to run on bot-created PRs
   workflow_dispatch:
   workflow_dispatch:
     inputs:
     inputs:
       pr_number:
       pr_number:
@@ -39,6 +44,13 @@ jobs:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     
     
     steps:
     steps:
+      - name: Checkout repository (for manual runs)
+        if: github.event_name == 'workflow_dispatch'
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+          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 != ''
         id: get_pr
         id: get_pr