|
| 1 | +name: Trigger N8N Security Scan |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + trigger-n8n: |
| 9 | + if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-security-scan') |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Prepare hybrid payload |
| 13 | + id: payload |
| 14 | + run: | |
| 15 | + echo "Building payload.json" |
| 16 | + # Ensure overrides is always valid JSON |
| 17 | + OVERRIDES='${{ github.event.inputs.overrides }}' |
| 18 | + if [ -z "$OVERRIDES" ]; then |
| 19 | + OVERRIDES="{}" |
| 20 | + fi |
| 21 | +
|
| 22 | + cat <<EOF > payload.json |
| 23 | + { |
| 24 | + "htmlUrl": "${{ github.event.issue.html_url }}", |
| 25 | + "repo": "${{ github.repository }}", |
| 26 | + "owner": "${{ github.repository_owner }}", |
| 27 | + "branch": "${{ github.ref_name }}", |
| 28 | + "commit": "${{ github.sha }}", |
| 29 | + "actor": "${{ github.actor }}", |
| 30 | +
|
| 31 | + "before": "${{ github.event.before || '' }}", |
| 32 | + "after": "${{ github.event.after || '' }}", |
| 33 | +
|
| 34 | + "pr": ${{ github.event.pull_request.number || 'null' }}, |
| 35 | + "prIssue": ${{ github.event.issue.pull_request.number || 'null' }}, |
| 36 | + |
| 37 | + "headSha": "${{ github.event.pull_request.head.sha || '' }}", |
| 38 | + "headRef": "${{ github.event.pull_request.head.ref || '' }}", |
| 39 | + "baseSha": "${{ github.event.pull_request.base.sha || '' }}", |
| 40 | + "baseRef": "${{ github.event.pull_request.base.ref || '' }}", |
| 41 | +
|
| 42 | + "cloneUrl": "${{ github.event.repository.clone_url || '' }}", |
| 43 | +
|
| 44 | + "overrides": $OVERRIDES |
| 45 | +
|
| 46 | + } |
| 47 | + EOF |
| 48 | +
|
| 49 | + echo "Payload built:" |
| 50 | + cat payload.json |
| 51 | +
|
| 52 | + - name: Send payload to n8n webhook |
| 53 | + run: | |
| 54 | + curl -X POST \ |
| 55 | + -H "Content-Type: application/json" \ |
| 56 | + -d @payload.json \ |
| 57 | + https://pandoras-box.oceanprotocol.io/webhook/66d5c38a-7df7-4106-a8e3-f3070fcb6858 |
0 commit comments