-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yml
More file actions
77 lines (67 loc) · 2.36 KB
/
Copy pathaction.yml
File metadata and controls
77 lines (67 loc) · 2.36 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
name: 'AI Harness Scorecard'
description: 'Grade repositories on engineering safeguards for safe AI-assisted development'
author: 'Mark Mishaev'
branding:
icon: 'shield'
color: 'blue'
inputs:
path:
description: 'Path to the repository to assess'
required: false
default: '.'
format:
description: 'Output format: markdown, json, or terminal'
required: false
default: 'markdown'
output-file:
description: 'File path for the report output'
required: false
default: 'scorecard-report.md'
badge-file:
description: 'File path for the shields.io endpoint badge JSON (set empty to skip)'
required: false
default: 'scorecard-badge.json'
outputs:
grade:
description: 'Letter grade (A/B/C/D/F)'
value: ${{ steps.assess.outputs.grade }}
score:
description: 'Numeric score (0-100)'
value: ${{ steps.assess.outputs.score }}
report-path:
description: 'Path to the generated report file'
value: ${{ steps.assess.outputs.report_path }}
badge-path:
description: 'Path to the generated badge JSON file'
value: ${{ steps.assess.outputs.badge_path }}
runs:
using: 'composite'
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install ai-harness-scorecard
shell: bash
run: pip install "${{ github.action_path }}"
- name: Run assessment
id: assess
shell: bash
run: |
mkdir -p "$(dirname "${{ inputs.output-file }}")"
BADGE_ARG=""
if [ -n "${{ inputs.badge-file }}" ]; then
mkdir -p "$(dirname "${{ inputs.badge-file }}")"
BADGE_ARG="--badge ${{ inputs.badge-file }}"
fi
ai-harness-scorecard assess "${{ inputs.path }}" \
--format "${{ inputs.format }}" \
-o "${{ inputs.output-file }}" \
$BADGE_ARG
JSON=$(ai-harness-scorecard assess "${{ inputs.path }}" --format json)
GRADE=$(echo "$JSON" | python3 -c "import json,sys; print(json.load(sys.stdin)['grade'])")
SCORE=$(echo "$JSON" | python3 -c "import json,sys; print(json.load(sys.stdin)['overall_score'])")
echo "grade=$GRADE" >> "$GITHUB_OUTPUT"
echo "score=$SCORE" >> "$GITHUB_OUTPUT"
echo "report_path=${{ inputs.output-file }}" >> "$GITHUB_OUTPUT"
echo "badge_path=${{ inputs.badge-file }}" >> "$GITHUB_OUTPUT"