aien-sovereign-core
Autonomous sovereign intelligence engine and runtime core for NVIDIA DGX Spark
Brought by drakestapleton
aien-sovereign-core / .github / workflows / sovereign-inquisitor.yml
| 1 | name: Sovereign Gatekeeper & Automated Reviewer |
| 2 | |
| 3 | on: |
| 4 | pull_request_target: |
| 5 | types: [opened, synchronize] |
| 6 | issues: |
| 7 | types: [opened] |
| 8 | issue_comment: |
| 9 | types: [created] |
| 10 | |
| 11 | permissions: |
| 12 | pull-requests: write |
| 13 | issues: write |
| 14 | contents: read |
| 15 | |
| 16 | jobs: |
| 17 | pr-reviewer: |
| 18 | if: github.event_name == 'pull_request_target' |
| 19 | runs-on: ubuntu-latest |
| 20 | steps: |
| 21 | - name: Checkout Sovereign Core |
| 22 | uses: actions/checkout@v4 |
| 23 | |
| 24 | - name: Build Sovereign Inquisitor |
| 25 | run: cargo build --release -p spark-inquisitor |
| 26 | |
| 27 | - name: Fetch PR Diff |
| 28 | env: |
| 29 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | run: | |
| 31 | gh pr diff "${{ github.event.pull_request.number }}" > pr.diff |
| 32 | |
| 33 | - name: Execute Sovereign Code Review |
| 34 | id: review |
| 35 | continue-on-error: true |
| 36 | run: | |
| 37 | ./target/release/spark-inquisitor review \ |
| 38 | --author "${{ github.event.pull_request.user.login }}" \ |
| 39 | --pr "${{ github.event.pull_request.number }}" \ |
| 40 | --title "${{ github.event.pull_request.title }}" \ |
| 41 | --diff pr.diff \ |
| 42 | --output comment.md \ |
| 43 | --output-labels labels.txt |
| 44 | |
| 45 | - name: Post PR Review Comment |
| 46 | if: always() && steps.review.conclusion != 'skipped' |
| 47 | env: |
| 48 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | run: | |
| 50 | if [ -f comment.md ]; then |
| 51 | gh pr comment "${{ github.event.pull_request.number }}" --body-file comment.md |
| 52 | fi |
| 53 | |
| 54 | - name: Apply Review Labels |
| 55 | if: always() && steps.review.conclusion != 'skipped' |
| 56 | env: |
| 57 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | run: | |
| 59 | if [ -f labels.txt ]; then |
| 60 | LABELS=$(cat labels.txt) |
| 61 | if [ -n "$LABELS" ]; then |
| 62 | gh pr edit "${{ github.event.pull_request.number }}" --add-label "$LABELS" || true |
| 63 | fi |
| 64 | fi |
| 65 | |
| 66 | - name: Verify Audit Invariants |
| 67 | run: | |
| 68 | if [ "${{ steps.review.outcome }}" != "success" ]; then |
| 69 | echo "Constitutional diff audit detected violations. See PR comment for details." |
| 70 | exit 1 |
| 71 | fi |
| 72 | |
| 73 | issue-triage: |
| 74 | if: github.event_name == 'issues' && github.event.action == 'opened' |
| 75 | runs-on: ubuntu-latest |
| 76 | steps: |
| 77 | - name: Checkout Sovereign Core |
| 78 | uses: actions/checkout@v4 |
| 79 | |
| 80 | - name: Build Sovereign Inquisitor |
| 81 | run: cargo build --release -p spark-inquisitor |
| 82 | |
| 83 | - name: Extract Issue Payload Safely |
| 84 | run: | |
| 85 | jq -r '.issue.body // ""' "$GITHUB_EVENT_PATH" > issue_body.txt |
| 86 | |
| 87 | - name: Execute Sovereign Issue Triage |
| 88 | run: | |
| 89 | ./target/release/spark-inquisitor triage-issue \ |
| 90 | --author "${{ github.event.issue.user.login }}" \ |
| 91 | --issue "${{ github.event.issue.number }}" \ |
| 92 | --title "${{ github.event.issue.title }}" \ |
| 93 | --body issue_body.txt \ |
| 94 | --output-comment issue_reply.md \ |
| 95 | --output-labels issue_labels.txt |
| 96 | |
| 97 | - name: Post Issue Triage Comment |
| 98 | env: |
| 99 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | run: | |
| 101 | if [ -f issue_reply.md ]; then |
| 102 | gh issue comment "${{ github.event.issue.number }}" --body-file issue_reply.md |
| 103 | fi |
| 104 | |
| 105 | - name: Apply Issue Labels |
| 106 | env: |
| 107 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 108 | run: | |
| 109 | if [ -f issue_labels.txt ]; then |
| 110 | LABELS=$(cat issue_labels.txt) |
| 111 | if [ -n "$LABELS" ]; then |
| 112 | gh issue edit "${{ github.event.issue.number }}" --add-label "$LABELS" || true |
| 113 | fi |
| 114 | fi |
| 115 | |
| 116 | comment-evaluator: |
| 117 | if: github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.issue.pull_request != null && github.event.comment.user.login != 'github-actions[bot]' && github.event.comment.user.login != 'aien-dev' |
| 118 | runs-on: ubuntu-latest |
| 119 | steps: |
| 120 | - name: Checkout Sovereign Core |
| 121 | uses: actions/checkout@v4 |
| 122 | |
| 123 | - name: Build Sovereign Inquisitor |
| 124 | run: cargo build --release -p spark-inquisitor |
| 125 | |
| 126 | - name: Extract Comment Payload Safely |
| 127 | run: | |
| 128 | jq -r '.comment.body // ""' "$GITHUB_EVENT_PATH" > comment_body.txt |
| 129 | |
| 130 | - name: Evaluate Contributor Testimony |
| 131 | id: eval |
| 132 | continue-on-error: true |
| 133 | run: | |
| 134 | ./target/release/spark-inquisitor evaluate \ |
| 135 | --testimony comment_body.txt \ |
| 136 | --author "${{ github.event.comment.user.login }}" \ |
| 137 | --output-comment verdict.md \ |
| 138 | --output-labels verdict_labels.txt |
| 139 | |
| 140 | - name: Post Verdict Comment |
| 141 | if: always() && steps.eval.conclusion != 'skipped' |
| 142 | env: |
| 143 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 144 | run: | |
| 145 | if [ -f verdict.md ]; then |
| 146 | gh pr comment "${{ github.event.issue.number }}" --body-file verdict.md |
| 147 | fi |
| 148 | |
| 149 | - name: Update PR Labels |
| 150 | if: always() && steps.eval.conclusion != 'skipped' |
| 151 | env: |
| 152 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 153 | run: | |
| 154 | if [ -f verdict_labels.txt ]; then |
| 155 | LABELS=$(cat verdict_labels.txt) |
| 156 | if [ -n "$LABELS" ]; then |
| 157 | gh pr edit "${{ github.event.issue.number }}" --add-label "$LABELS" || true |
| 158 | fi |
| 159 | fi |