-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
70 lines (68 loc) · 2.46 KB
/
Copy pathaction.yml
File metadata and controls
70 lines (68 loc) · 2.46 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
name: RAGProof gate
description: Run a RAGProof evaluation against a pipeline and fail the build on quality regression.
branding:
icon: check-circle
color: blue
inputs:
config:
description: Path to ragproof.yaml.
default: ragproof.yaml
baseline:
description: Baseline run for relative thresholds (id, prefix, or 'latest').
default: ""
install:
description: Pip requirement to install ragproof from. Use "." to install from the checkout.
default: ragproof
python-version:
description: Python version to run on.
default: "3.12"
comment:
description: Post the Markdown summary as a sticky pull request comment.
default: "true"
runs:
using: composite
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- shell: bash
run: pip install "${{ inputs.install }}"
- shell: bash
run: ragproof run --config "${{ inputs.config }}"
- id: gate
shell: bash
run: |
set +e
ragproof gate --config "${{ inputs.config }}" \
${{ inputs.baseline && format('--baseline {0}', inputs.baseline) || '' }} \
--junit ragproof-junit.xml
echo "exit_code=$?" >> "$GITHUB_OUTPUT"
- shell: bash
run: |
ragproof report latest --config "${{ inputs.config }}" \
--html ragproof-report.html --md ragproof-summary.md
- uses: actions/upload-artifact@v4
with:
name: ragproof-report
path: |
ragproof-report.html
ragproof-junit.xml
- if: ${{ inputs.comment == 'true' && github.event_name == 'pull_request' }}
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const body = fs.readFileSync('ragproof-summary.md', 'utf8');
const marker = '<!-- ragproof -->';
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const comments = await github.rest.issues.listComments({ owner, repo, issue_number });
const existing = comments.data.find(c => c.body.includes(marker));
const content = `${marker}\n${body}`;
if (existing) {
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body: content });
} else {
await github.rest.issues.createComment({ owner, repo, issue_number, body: content });
}
- shell: bash
run: exit ${{ steps.gate.outputs.exit_code }}