open-humanity
Privacy-first peer assistance network for sovereign autonomous agents
Brought by drakestapleton
open-humanity / .github / workflows / sovereign-reviewer.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 Open Humanity |
| 22 | uses: actions/checkout@v4 |
| 23 | |
| 24 | - name: Checkout Sovereign Inquisitor Core |
| 25 | uses: actions/checkout@v4 |
| 26 | with: |
| 27 | repository: aien-dev/aien-sovereign-core |
| 28 | path: sovereign-core |
| 29 | |
| 30 | - name: Build Sovereign Inquisitor |
| 31 | run: cargo build --release --manifest-path sovereign-core/Cargo.toml -p spark-inquisitor |
| 32 | |
| 33 | - name: Verify Open Humanity Test Suite |
| 34 | run: cargo test --verbose |
| 35 | |
| 36 | - name: Fetch PR Diff |
| 37 | env: |
| 38 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | run: | |
| 40 | gh pr diff "${{ github.event.pull_request.number }}" > pr.diff |
| 41 | |
| 42 | - name: Execute Sovereign Code Review |
| 43 | id: review |
| 44 | continue-on-error: true |
| 45 | run: | |
| 46 | ./sovereign-core/target/release/spark-inquisitor review \ |
| 47 | --author "${{ github.event.pull_request.user.login }}" \ |
| 48 | --pr "${{ github.event.pull_request.number }}" \ |
| 49 | --title "${{ github.event.pull_request.title }}" \ |
| 50 | --diff pr.diff \ |
| 51 | --output comment.md \ |
| 52 | --output-labels labels.txt |
| 53 | |
| 54 | - name: Post PR Review Comment |
| 55 | if: always() && steps.review.conclusion != 'skipped' |
| 56 | env: |
| 57 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | run: | |
| 59 | if [ -f comment.md ]; then |
| 60 | gh pr comment "${{ github.event.pull_request.number }}" --body-file comment.md |
| 61 | fi |
| 62 | |
| 63 | - name: Apply Review Labels |
| 64 | if: always() && steps.review.conclusion != 'skipped' |
| 65 | env: |
| 66 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | run: | |
| 68 | if [ -f labels.txt ]; then |
| 69 | LABELS=$(cat labels.txt) |
| 70 | if [ -n "$LABELS" ]; then |
| 71 | gh pr edit "${{ github.event.pull_request.number }}" --add-label "$LABELS" || true |
| 72 | fi |
| 73 | fi |
| 74 | |
| 75 | - name: Verify Audit Invariants |
| 76 | run: | |
| 77 | if [ "${{ steps.review.outcome }}" != "success" ]; then |
| 78 | echo "Constitutional diff audit detected violations. See PR comment for details." |
| 79 | exit 1 |
| 80 | fi |
| 81 | |
| 82 | issue-triage: |
| 83 | if: github.event_name == 'issues' && github.event.action == 'opened' |
| 84 | runs-on: ubuntu-latest |
| 85 | steps: |
| 86 | - name: Checkout Sovereign Inquisitor Core |
| 87 | uses: actions/checkout@v4 |
| 88 | with: |
| 89 | repository: aien-dev/aien-sovereign-core |
| 90 | |
| 91 | - name: Build Sovereign Inquisitor |
| 92 | run: cargo build --release -p spark-inquisitor |
| 93 | |
| 94 | - name: Extract Issue Payload Safely |
| 95 | run: | |
| 96 | jq -r '.issue.body // ""' "$GITHUB_EVENT_PATH" > issue_body.txt |
| 97 | |
| 98 | - name: Execute Sovereign Issue Triage |
| 99 | run: | |
| 100 | ./target/release/spark-inquisitor triage-issue \ |
| 101 | --author "${{ github.event.issue.user.login }}" \ |
| 102 | --issue "${{ github.event.issue.number }}" \ |
| 103 | --title "${{ github.event.issue.title }}" \ |
| 104 | --body issue_body.txt \ |
| 105 | --output-comment issue_reply.md \ |
| 106 | --output-labels issue_labels.txt |
| 107 | |
| 108 | - name: Post Issue Triage Comment |
| 109 | env: |
| 110 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 111 | run: | |
| 112 | if [ -f issue_reply.md ]; then |
| 113 | gh issue comment "${{ github.event.issue.number }}" --body-file issue_reply.md |
| 114 | fi |
| 115 | |
| 116 | - name: Apply Issue Labels |
| 117 | env: |
| 118 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 119 | run: | |
| 120 | if [ -f issue_labels.txt ]; then |
| 121 | LABELS=$(cat issue_labels.txt) |
| 122 | if [ -n "$LABELS" ]; then |
| 123 | gh issue edit "${{ github.event.issue.number }}" --add-label "$LABELS" || true |
| 124 | fi |
| 125 | fi |
| 126 | |
| 127 | comment-evaluator: |
| 128 | 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' |
| 129 | runs-on: ubuntu-latest |
| 130 | steps: |
| 131 | - name: Checkout Sovereign Inquisitor Core |
| 132 | uses: actions/checkout@v4 |
| 133 | with: |
| 134 | repository: aien-dev/aien-sovereign-core |
| 135 | |
| 136 | - name: Build Sovereign Inquisitor |
| 137 | run: cargo build --release -p spark-inquisitor |
| 138 | |
| 139 | - name: Extract Comment Payload Safely |
| 140 | run: | |
| 141 | jq -r '.comment.body // ""' "$GITHUB_EVENT_PATH" > comment_body.txt |
| 142 | |
| 143 | - name: Evaluate Contributor Testimony |
| 144 | id: eval |
| 145 | continue-on-error: true |
| 146 | run: | |
| 147 | ./target/release/spark-inquisitor evaluate \ |
| 148 | --testimony comment_body.txt \ |
| 149 | --author "${{ github.event.comment.user.login }}" \ |
| 150 | --output-comment verdict.md \ |
| 151 | --output-labels verdict_labels.txt |
| 152 | |
| 153 | - name: Post Verdict Comment |
| 154 | if: always() && steps.eval.conclusion != 'skipped' |
| 155 | env: |
| 156 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 157 | run: | |
| 158 | if [ -f verdict.md ]; then |
| 159 | gh pr comment "${{ github.event.issue.number }}" --body-file verdict.md |
| 160 | fi |
| 161 | |
| 162 | - name: Update PR Labels |
| 163 | if: always() && steps.eval.conclusion != 'skipped' |
| 164 | env: |
| 165 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 166 | run: | |
| 167 | if [ -f verdict_labels.txt ]; then |
| 168 | LABELS=$(cat verdict_labels.txt) |
| 169 | if [ -n "$LABELS" ]; then |
| 170 | gh pr edit "${{ github.event.issue.number }}" --add-label "$LABELS" || true |
| 171 | fi |
| 172 | fi |