forked from AzurLiu/falsiflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
277 lines (258 loc) · 9.45 KB
/
Copy pathaction.yml
File metadata and controls
277 lines (258 loc) · 9.45 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
name: Falsiflow
description: "Install Falsiflow and run evidence gates in GitHub Actions."
author: Falsiflow contributors
branding:
icon: check-circle
color: blue
inputs:
mode:
description: "Gate to run: claim-check, template-check, casebook-check, release-check, adoption-check, quickstart, or external-check."
required: false
default: claim-check
python-version:
description: "Python version for actions/setup-python."
required: false
default: "3.11"
install-command:
description: "Command that installs Falsiflow before running the gate. Defaults to the versioned action checkout."
required: false
default: 'python -m pip install "$GITHUB_ACTION_PATH"'
working-directory:
description: "Directory where the Falsiflow command should run."
required: false
default: "."
out-dir:
description: "Output directory for generated Falsiflow artifacts."
required: false
default: data/falsiflow/action_check
project-dir:
description: "Project directory for claim-check mode."
required: false
default: ""
config:
description: "Project config path for claim-check mode when project-dir is not used."
required: false
default: ""
evidence:
description: "Evidence CSV path for claim-check mode. Overrides the project-dir default when provided."
required: false
default: ""
template-dir:
description: "Template directory for template-check mode."
required: false
default: ""
template:
description: "Starter template for quickstart mode."
required: false
default: biointerface_coatings
evidence-file:
description: "Structured external evidence JSON for external-check mode."
required: false
default: ""
strict:
description: "Use strict mode for claim-check, quickstart, and external-check."
required: false
default: "true"
force:
description: "Replace existing Falsiflow output directories."
required: false
default: "true"
skip-dist:
description: "Skip distribution build inside release-check."
required: false
default: "false"
extra-args:
description: "Additional shell-split arguments appended to the Falsiflow command."
required: false
default: ""
outputs:
out-dir:
description: "Directory containing generated Falsiflow artifacts."
value: ${{ steps.falsiflow.outputs.out-dir }}
summary-json:
description: "Main machine-readable summary file produced by the selected mode."
value: ${{ steps.falsiflow.outputs.summary-json }}
summary-md:
description: "Main human-readable Markdown report produced by the selected mode when available."
value: ${{ steps.falsiflow.outputs.summary-md }}
runs:
using: composite
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- name: Install Falsiflow
shell: bash
run: |
set -euo pipefail
cd "${{ inputs.working-directory }}"
python -m pip install --upgrade pip
${{ inputs.install-command }}
- name: Run Falsiflow gate
id: falsiflow
shell: bash
env:
FALSIFLOW_MODE: ${{ inputs.mode }}
FALSIFLOW_OUT_DIR: ${{ inputs.out-dir }}
FALSIFLOW_PROJECT_DIR: ${{ inputs.project-dir }}
FALSIFLOW_CONFIG: ${{ inputs.config }}
FALSIFLOW_EVIDENCE: ${{ inputs.evidence }}
FALSIFLOW_TEMPLATE_DIR: ${{ inputs.template-dir }}
FALSIFLOW_TEMPLATE: ${{ inputs.template }}
FALSIFLOW_EVIDENCE_FILE: ${{ inputs.evidence-file }}
FALSIFLOW_STRICT: ${{ inputs.strict }}
FALSIFLOW_FORCE: ${{ inputs.force }}
FALSIFLOW_SKIP_DIST: ${{ inputs.skip-dist }}
FALSIFLOW_EXTRA_ARGS: ${{ inputs.extra-args }}
run: |
set -euo pipefail
cd "${{ inputs.working-directory }}"
mode="$FALSIFLOW_MODE"
out_dir="$FALSIFLOW_OUT_DIR"
summary_json=""
summary_md=""
cmd=(falsiflow)
add_force() {
if [ "$FALSIFLOW_FORCE" = "true" ]; then
cmd+=(--force)
fi
}
add_strict() {
if [ "$FALSIFLOW_STRICT" = "true" ]; then
cmd+=(--strict)
fi
}
case "$mode" in
claim-check)
cmd+=(claim-check --out-dir "$out_dir")
if [ -n "$FALSIFLOW_PROJECT_DIR" ]; then
cmd+=(--project-dir "$FALSIFLOW_PROJECT_DIR")
if [ -n "$FALSIFLOW_EVIDENCE" ]; then
cmd+=(--evidence "$FALSIFLOW_EVIDENCE")
fi
else
if [ -z "$FALSIFLOW_CONFIG" ] || [ -z "$FALSIFLOW_EVIDENCE" ]; then
echo "claim-check mode requires project-dir, or both config and evidence." >&2
exit 2
fi
cmd+=(--config "$FALSIFLOW_CONFIG" --evidence "$FALSIFLOW_EVIDENCE")
fi
add_force
add_strict
summary_json="$out_dir/claim_check.json"
summary_md="$out_dir/claim_check.md"
;;
template-check)
if [ -z "$FALSIFLOW_TEMPLATE_DIR" ]; then
echo "template-check mode requires template-dir." >&2
exit 2
fi
cmd+=(template-check --template-dir "$FALSIFLOW_TEMPLATE_DIR" --out-dir "$out_dir")
add_force
summary_json="$out_dir/template_check.json"
summary_md="$out_dir/template_check.md"
;;
casebook-check)
cmd+=(casebook-check --out-dir "$out_dir")
add_force
summary_json="$out_dir/casebook_check.json"
summary_md="$out_dir/casebook_check.md"
;;
release-check)
cmd+=(release-check --out-dir "$out_dir")
add_force
if [ "$FALSIFLOW_SKIP_DIST" = "true" ]; then
cmd+=(--skip-dist)
fi
summary_json="$out_dir/release_check.json"
summary_md="$out_dir/release_check.md"
;;
adoption-check)
cmd+=(adoption-check --out-dir "$out_dir")
add_force
summary_json="$out_dir/adoption_check.json"
summary_md="$out_dir/adoption_check.md"
;;
quickstart)
cmd+=(quickstart --template "$FALSIFLOW_TEMPLATE" --out "$out_dir")
add_force
add_strict
summary_json="$out_dir/quickstart_summary.json"
summary_md="$out_dir/quickstart_summary.md"
;;
external-check)
cmd+=(external-check --out-dir "$out_dir")
if [ -n "$FALSIFLOW_EVIDENCE_FILE" ]; then
cmd+=(--evidence "$FALSIFLOW_EVIDENCE_FILE")
fi
add_force
add_strict
summary_json="$out_dir/external_readiness.json"
summary_md="$out_dir/external_readiness.md"
;;
*)
echo "Unsupported Falsiflow action mode: $mode" >&2
exit 2
;;
esac
if [ -n "$FALSIFLOW_EXTRA_ARGS" ]; then
# shellcheck disable=SC2206
extra_args=($FALSIFLOW_EXTRA_ARGS)
cmd+=("${extra_args[@]}")
fi
cmd+=(--json)
echo "Running: ${cmd[*]}"
set +e
"${cmd[@]}"
falsiflow_status=$?
set -e
if [ -n "$summary_json" ] && [ -f "$summary_json" ] && [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
python - "$summary_json" "$mode" <<'PY' >> "$GITHUB_STEP_SUMMARY"
import json
import sys
path, mode = sys.argv[1:3]
summary = json.load(open(path, encoding="utf-8"))
status = summary.get("status", "")
claim = summary.get("claim_id") or summary.get("project_id") or summary.get("template") or mode
blocking_stage = summary.get("blocking_stage", "")
print("## Falsiflow evidence gate")
print()
print(f"- Mode: `{mode}`")
print(f"- Status: `{status}`")
print(f"- Subject: `{claim}`")
if blocking_stage:
print(f"- Blocking stage: `{blocking_stage}`")
print(f"- Summary JSON: `{path}`")
blockers = []
for blocker in summary.get("top_blockers", [])[:5]:
if isinstance(blocker, dict):
blockers.append((blocker.get("gate_id", ""), blocker))
if blockers:
print()
print("### Top blockers")
for gate_id, blocker in blockers:
reasons = "; ".join(str(reason) for reason in blocker.get("reasons", []))
print(f"- `{gate_id}` `{blocker.get('sample_id', '')}` `{blocker.get('field', '')}`: {reasons}")
actions = summary.get("next_actions", [])
if isinstance(actions, list) and actions:
print()
print("### Next evidence to add")
for action in actions[:5]:
if isinstance(action, dict):
print(f"- `{action.get('action_id', '')}`: {action.get('why', '')}")
todo = summary.get("evidence_todo", [])
if isinstance(todo, list) and todo:
print()
print("### Evidence todo")
for item in todo[:5]:
if isinstance(item, dict):
print(f"- `{item.get('gate_id', '')}/{item.get('sample_id', '')}/{item.get('field', '')}`: {item.get('repair_hint', '')}")
PY
fi
{
echo "out-dir=$out_dir"
echo "summary-json=$summary_json"
echo "summary-md=$summary_md"
} >> "$GITHUB_OUTPUT"
exit "$falsiflow_status"