-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
109 lines (99 loc) · 3.92 KB
/
Copy pathaction.yml
File metadata and controls
109 lines (99 loc) · 3.92 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
name: AgentFit
description: Evaluate whether a repository is ready for coding agents.
author: AgentFit
branding:
icon: check-circle
color: green
inputs:
version:
description: AgentFit npm package version to run.
required: false
default: "0.1.13"
adapter:
description: Evaluation adapter to run.
required: false
default: dry-run
fail-below-score:
description: Fail the action when the AgentFit score is below this integer from 0 to 100.
required: false
default: "70"
task-count:
description: Number of generated fitness tasks to evaluate.
required: false
default: "5"
run-tasks:
description: Execute generated tasks in isolated worktrees.
required: false
default: "false"
timeout-seconds:
description: Maximum seconds for each task run.
required: false
default: "900"
budget-usd:
description: Maximum adapter budget in USD.
required: false
default: "1"
format:
description: Human report format to generate.
required: false
default: markdown
outputs:
score:
description: Final AgentFit score.
value: ${{ steps.collect.outputs.score }}
report-path:
description: Path to the human-readable report.
value: ${{ steps.collect.outputs.report-path }}
json-path:
description: Path to the JSON report.
value: ${{ steps.collect.outputs.json-path }}
runs:
using: composite
steps:
- name: Prepare report directory
shell: bash
run: mkdir -p .agentfit/reports .agentfit/npm-exec
- name: Generate reports
shell: bash
env:
AGENTFIT_VERSION: ${{ inputs.version }}
AGENTFIT_ADAPTER: ${{ inputs.adapter }}
AGENTFIT_TASK_COUNT: ${{ inputs.task-count }}
AGENTFIT_RUN_TASKS: ${{ inputs.run-tasks }}
AGENTFIT_TIMEOUT_SECONDS: ${{ inputs.timeout-seconds }}
AGENTFIT_BUDGET_USD: ${{ inputs.budget-usd }}
AGENTFIT_FORMAT: ${{ inputs.format }}
run: |
if [[ ! "${AGENTFIT_VERSION}" =~ ^[A-Za-z0-9._~-]+$ ]]; then
echo "Invalid AgentFit version input. Use a semver version or npm dist-tag." >&2
exit 1
fi
if [[ "${AGENTFIT_RUN_TASKS}" != "true" && "${AGENTFIT_RUN_TASKS}" != "false" ]]; then
echo "Invalid run-tasks input. Use true or false." >&2
exit 1
fi
args=(
eval
--adapter "${AGENTFIT_ADAPTER}"
--tasks "${AGENTFIT_TASK_COUNT}"
--timeout-seconds "${AGENTFIT_TIMEOUT_SECONDS}"
--budget-usd "${AGENTFIT_BUDGET_USD}"
--format "${AGENTFIT_FORMAT}"
--output .agentfit/reports/agentfit.md
--json-output .agentfit/reports/agentfit.json
)
if [[ "${AGENTFIT_RUN_TASKS}" == "true" ]]; then
args+=(--run-tasks)
fi
npm exec --yes --prefix .agentfit/npm-exec --package "@kingkyylian/agentfit@${AGENTFIT_VERSION}" -- agentfit "${args[@]}"
- name: Collect outputs
id: collect
shell: bash
env:
AGENTFIT_FAIL_BELOW_SCORE: ${{ inputs.fail-below-score }}
run: |
score="$(node -e "const fs=require('fs'); const report=JSON.parse(fs.readFileSync('.agentfit/reports/agentfit.json','utf8')); console.log(report.score)")"
echo "score=${score}" >> "${GITHUB_OUTPUT}"
echo "report-path=.agentfit/reports/agentfit.md" >> "${GITHUB_OUTPUT}"
echo "json-path=.agentfit/reports/agentfit.json" >> "${GITHUB_OUTPUT}"
node -e 'const score=Number(process.argv[1]); const min=Number(process.argv[2]); if (!Number.isInteger(score) || score < 0 || score > 100) { console.error(`Invalid AgentFit report score: ${process.argv[1]}`); process.exit(1); } if (!Number.isInteger(min) || min < 0 || min > 100) { console.error("Invalid fail-below-score input. Use an integer from 0 to 100."); process.exit(1); } if (score < min) { console.error(`AgentFit score ${score} is below ${min}`); process.exit(1); }' "${score}" "${AGENTFIT_FAIL_BELOW_SCORE}"