Github Action跨仓库触发构建求助:Ghidra联动ghidra-ci失败
Let's break down your problem into two parts: fixing the "Unexpected inputs provided" error in your current workflow, and implementing a real-time trigger for builds when your forked Ghidra repo updates.
1. Fixing the "Unexpected inputs provided" Error
The error occurs because your Ghidra Build workflow doesn't explicitly define the input parameters you're trying to pass when triggering it. You need to add these input definitions to the workflow configuration:
name: Ghidra Build on: workflow_dispatch: # Add these input fields to match what you're passing from the check workflow inputs: rev: description: 'Full commit hash of the Ghidra revision to build' required: true prevRev: description: 'Short commit hash of the last released revision' required: false # Keep these if you still want builds when the ci repo itself is updated push: pull_request: jobs: build: runs-on: ubuntu-latest steps: # Example: Use the input to check out the correct Ghidra revision - uses: actions/checkout@v4 with: repository: Lockna/Ghidra ref: ${{ github.event.inputs.rev }} # Rest of your existing build steps...
Once you add these inputs, the workflow-dispatch action will recognize the parameters you're sending and stop throwing errors.
2. Real-Time Trigger: Build on Ghidra Repo Push (No Cron Needed)
Instead of relying on scheduled checks, you can set up an automatic trigger that fires immediately when your forked Ghidra repo receives new commits. Here are two reliable approaches:
Option A: Trigger Directly from Ghidra Repo's Workflow
Add a new workflow file to your forked Ghidra repo (.github/workflows/trigger-ci.yml) that sends a build request to your ghidra-ci repo whenever code is pushed:
name: Trigger Ghidra CI Build on: push: branches: [ main ] # Target the branch you want to monitor for updates jobs: trigger-ci: runs-on: ubuntu-latest steps: - name: Dispatch Build to ghidra-ci uses: benc-uk/workflow-dispatch@v1.1 with: workflow: "Ghidra Build" repo: Lockna/ghidra-ci token: ${{ secrets.PAT_TOKEN }} inputs: '{ "rev": "${{ github.sha }}", "prevRev": "${{ github.event.before }}" }'
Option B: Use Repository Dispatch (More Flexible)
If you want finer control over event types, use GitHub's repository_dispatch event:
- In your Ghidra repo, add a workflow to send a dispatch event on push:
name: Send Build Trigger on: push: branches: [ main ] jobs: send-dispatch: runs-on: ubuntu-latest steps: - name: Trigger ghidra-ci Build uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.PAT_TOKEN }} repository: Lockna/ghidra-ci event-type: ghidra-updated client-payload: '{"rev": "${{ github.sha }}", "prevRev": "${{ github.event.before }}"}'
- In your ghidra-ci repo, update the
Ghidra Buildworkflow to listen for this event:
name: Ghidra Build on: workflow_dispatch: inputs: rev: description: 'Full commit hash of the Ghidra revision to build' required: true prevRev: description: 'Short commit hash of the last released revision' required: false repository_dispatch: types: [ ghidra-updated ] # Match the event-type from the Ghidra workflow push: pull_request: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: repository: Lockna/Ghidra # Use payload from either workflow dispatch or repository dispatch ref: ${{ github.event.inputs.rev || github.event.client_payload.rev }} # Rest of your build steps...
Key Notes
- PAT Permissions: Ensure your
PAT_TOKENhas therepoandworkflowscopes to access both repos and trigger workflows. Store it as a secret in the repo that sends the trigger (your Ghidra repo). - Branch Targeting: Adjust the
branchesfield in the push triggers to match the specific branches you want to monitor for updates.
内容的提问来源于stack exchange,提问作者Lockna

