-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (73 loc) · 2.54 KB
/
reflect-and-propose.yml
File metadata and controls
84 lines (73 loc) · 2.54 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
name: Reflect and propose prompt mutations
on:
schedule:
- cron: "0 9 * * 1"
workflow_dispatch:
push:
paths:
- "data/pipeline-runs.jsonl"
jobs:
reflect:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
models: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Decide whether to run reflect loop
id: gate
shell: bash
run: |
set -euo pipefail
lines=0
if [[ -f data/pipeline-runs.jsonl ]]; then
lines=$(grep -cve '^[[:space:]]*$' data/pipeline-runs.jsonl || true)
fi
should_run=false
if [[ "$lines" -gt 0 ]]; then
if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
should_run=true
elif (( lines % 50 == 0 )); then
should_run=true
fi
fi
echo "line_count=$lines" >> "$GITHUB_OUTPUT"
echo "should_run=$should_run" >> "$GITHUB_OUTPUT"
- name: Stop early when no scorebook window is ready
if: steps.gate.outputs.should_run != 'true'
run: |
echo "Skipping reflect loop; non-empty scorebook line count is ${{ steps.gate.outputs.line_count }}."
- name: Run reflect agent via GitHub Models
if: steps.gate.outputs.should_run == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WINDOW_SIZE: "50"
shell: bash
run: |
set -euo pipefail
python scripts/run_reflect.py --window-size "$WINDOW_SIZE"
- name: Detect whether report has mutation proposals
if: steps.gate.outputs.should_run == 'true'
id: proposals
shell: bash
run: |
set -euo pipefail
python scripts/detect_reflect_proposals.py --report reflect-report.md
- name: Create mutation proposal PR
if: steps.gate.outputs.should_run == 'true' && steps.proposals.outputs.has_proposals == 'true'
uses: peter-evans/create-pull-request@v6
with:
branch: chore/reflect-proposals-${{ github.run_id }}
title: "chore: reflect prompt mutation proposals"
commit-message: "chore: add reflect mutation proposals"
body-path: reflect-report.md
add-paths: |
reflect-report.md