-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
286 lines (257 loc) · 8.97 KB
/
action.yml
File metadata and controls
286 lines (257 loc) · 8.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
name: "LyingDocs"
description: "Documentation-code misalignment detection. A trust layer for your repository."
author: "LyingDocs"
branding:
icon: "shield"
color: "orange"
inputs:
doc-path:
description: "Path to documentation root directory (relative to repo root)"
required: true
default: "docs"
code-path:
description: "Path to code repository root (relative to repo root)"
required: false
default: "."
config:
description: "Path to lyingdocs.toml config file (optional)"
required: false
default: ""
# --- Backend selection ---
backend:
description: "Argus backend: local, claude_code, or codex"
required: false
default: "local"
# --- Provider selection ---
hermes-provider:
description: "LLM provider for Hermes agent: openai or anthropic. Auto-set to 'anthropic' when backend is claude_code."
required: false
default: ""
argus-provider:
description: "LLM provider for Argus local backend: openai or anthropic"
required: false
default: ""
# --- Hermes (planner) configuration ---
hermes-model:
description: "LLM model for Hermes agent"
required: false
default: ""
hermes-base-url:
description: "API base URL for Hermes agent"
required: false
default: ""
# --- Argus (code analyzer) configuration ---
argus-model:
description: "LLM model for Argus agent"
required: false
default: ""
argus-base-url:
description: "API base URL for Argus agent"
required: false
default: ""
# --- API keys ---
openai-api-key:
description: "OpenAI API key (for local/codex backends)"
required: false
default: ""
anthropic-api-key:
description: "Anthropic API key (for claude_code backend, billed per API usage)"
required: false
default: ""
claude-oauth-token:
description: "Claude Code OAuth token (for claude_code backend, uses Pro/Max subscription quota). Generate with: claude setup-token"
required: false
default: ""
# --- Limits ---
max-dispatches:
description: "Maximum number of Argus dispatches"
required: false
default: ""
max-iterations:
description: "Maximum Hermes loop iterations"
required: false
default: ""
# --- Output options ---
gen-issue:
description: "Generate GitHub issue drafts from findings (true/false)"
required: false
default: "false"
comment-on-pr:
description: "Post findings as a PR comment (true/false)"
required: false
default: "true"
python-version:
description: "Python version to use"
required: false
default: "3.12"
outputs:
report-path:
description: "Path to the generated Misalignment Report"
value: ${{ steps.run.outputs.report-path }}
findings-count:
description: "Number of misalignment findings"
value: ${{ steps.run.outputs.findings-count }}
has-findings:
description: "Whether any misalignments were found (true/false)"
value: ${{ steps.run.outputs.has-findings }}
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install LyingDocs
shell: bash
run: pip install lyingdocs
- name: Run LyingDocs analysis
id: run
shell: bash
env:
OPENAI_API_KEY: ${{ inputs.openai-api-key }}
ANTHROPIC_API_KEY: ${{ inputs.anthropic-api-key }}
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude-oauth-token }}
run: |
# Provider auto-detection:
# - If user explicitly set hermes-provider, use it.
# - If backend=claude_code and ANTHROPIC_API_KEY is available but
# OPENAI_API_KEY is not, default Hermes to anthropic.
# - Otherwise leave it to lyingdocs config defaults (openai).
HERMES_PROVIDER="${{ inputs.hermes-provider }}"
if [ -z "$HERMES_PROVIDER" ] && [ "${{ inputs.backend }}" = "claude_code" ]; then
if [ -n "$ANTHROPIC_API_KEY" ] && [ -z "$OPENAI_API_KEY" ]; then
HERMES_PROVIDER="anthropic"
fi
fi
if [ -n "$HERMES_PROVIDER" ]; then
export HERMES_PROVIDER
fi
ARGUS_PROVIDER="${{ inputs.argus-provider }}"
if [ -n "$ARGUS_PROVIDER" ]; then
export ARGUS_PROVIDER
fi
# Build command
CMD="lyingdocs analyze"
CMD="$CMD --doc-path ${{ inputs.doc-path }}"
CMD="$CMD --code-path ${{ inputs.code-path }}"
CMD="$CMD --output-dir lyingdocs-output"
CMD="$CMD --argus-backend ${{ inputs.backend }}"
# Optional config file
if [ -n "${{ inputs.config }}" ]; then
CMD="$CMD --config ${{ inputs.config }}"
fi
# Optional model overrides
if [ -n "${{ inputs.hermes-model }}" ]; then
CMD="$CMD --hermes-model ${{ inputs.hermes-model }}"
fi
if [ -n "${{ inputs.hermes-base-url }}" ]; then
CMD="$CMD --hermes-base-url ${{ inputs.hermes-base-url }}"
fi
if [ -n "${{ inputs.argus-model }}" ]; then
CMD="$CMD --argus-model ${{ inputs.argus-model }}"
fi
if [ -n "${{ inputs.argus-base-url }}" ]; then
CMD="$CMD --argus-base-url ${{ inputs.argus-base-url }}"
fi
# Optional limits
if [ -n "${{ inputs.max-dispatches }}" ]; then
CMD="$CMD --max-dispatches ${{ inputs.max-dispatches }}"
fi
if [ -n "${{ inputs.max-iterations }}" ]; then
CMD="$CMD --max-iterations ${{ inputs.max-iterations }}"
fi
# Optional issue generation
if [ "${{ inputs.gen-issue }}" = "true" ]; then
CMD="$CMD --gen-issue"
fi
echo "Running: $CMD"
eval $CMD
# Set outputs
REPORT="lyingdocs-output/Misalignment_Report.md"
if [ -f "$REPORT" ]; then
echo "report-path=$REPORT" >> "$GITHUB_OUTPUT"
# Count findings from JSONL
FINDINGS_FILE="lyingdocs-output/findings.jsonl"
if [ -f "$FINDINGS_FILE" ]; then
COUNT=$(wc -l < "$FINDINGS_FILE")
else
COUNT=0
fi
echo "findings-count=$COUNT" >> "$GITHUB_OUTPUT"
if [ "$COUNT" -gt 0 ]; then
echo "has-findings=true" >> "$GITHUB_OUTPUT"
else
echo "has-findings=false" >> "$GITHUB_OUTPUT"
fi
else
echo "report-path=" >> "$GITHUB_OUTPUT"
echo "findings-count=0" >> "$GITHUB_OUTPUT"
echo "has-findings=false" >> "$GITHUB_OUTPUT"
fi
- name: Add report to job summary
if: always()
shell: bash
run: |
REPORT="lyingdocs-output/Misalignment_Report.md"
if [ -f "$REPORT" ]; then
echo "## LyingDocs Misalignment Report" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
cat "$REPORT" >> "$GITHUB_STEP_SUMMARY"
else
echo "## LyingDocs" >> "$GITHUB_STEP_SUMMARY"
echo "No report generated." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Comment on PR
if: >-
inputs.comment-on-pr == 'true'
&& github.event_name == 'pull_request'
&& always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const reportPath = 'lyingdocs-output/Misalignment_Report.md';
let body;
if (fs.existsSync(reportPath)) {
const report = fs.readFileSync(reportPath, 'utf8');
const findingsCount = '${{ steps.run.outputs.findings-count }}';
const icon = findingsCount > 0 ? ':warning:' : ':white_check_mark:';
body = `## ${icon} LyingDocs Misalignment Report\n\n`
+ `**${findingsCount} misalignment(s) found.**\n\n`
+ `<details>\n<summary>Click to expand full report</summary>\n\n`
+ `${report}\n\n</details>`;
} else {
body = '## LyingDocs\n\nAnalysis did not produce a report.';
}
// Find existing LyingDocs comment to update (avoid spam)
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c =>
c.body.includes('LyingDocs Misalignment Report')
&& c.user.type === 'Bot'
);
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: lyingdocs-report
path: lyingdocs-output/
if-no-files-found: ignore