Skip to content

Commit 2f391f1

Browse files
author
Antigravity
committed
Operational Fusion: Canonical threading, duplicate cleanup, and SSOT locking
1 parent 4369b2d commit 2f391f1

1 file changed

Lines changed: 59 additions & 10 deletions

File tree

.github/workflows/load-test.yml

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: 부하 테스트 (Scheduled Load Testing)
22

33
permissions:
4-
contents: read
4+
contents: write
55
issues: write
66

77
concurrency:
@@ -202,21 +202,70 @@ jobs:
202202
run: |
203203
cat outputs/weekly_report.md >> $GITHUB_STEP_SUMMARY
204204
205-
- name: Append Weekly Report to Thread Issue
205+
- name: Resolve canonical + close duplicates (load-test-thread)
206+
if: always() && env.SELECTED_SCENARIO == 'all' && github.event_name == 'schedule'
207+
id: issue
208+
uses: actions/github-script@v7
209+
with:
210+
script: |
211+
const owner = context.repo.owner, repo = context.repo.repo, label = "load-test-thread";
212+
const {data: issues} = await github.rest.issues.listForRepo({ owner, repo, labels: label, state: "open", per_page: 100 });
213+
let canonical = issues.sort((a,b) => new Date(a.created_at) - new Date(b.created_at))[0];
214+
if (!canonical) {
215+
canonical = (await github.rest.issues.create({
216+
owner, repo,
217+
title: "Load Test Weekly Reports (Thread)",
218+
body: "# Weekly Load Test Reports\nLiving thread for weekly results.\nLabel: load-test-thread",
219+
labels: [label, "ops", "load-test"]
220+
})).data;
221+
}
222+
const dupes = issues.filter(i => i.number !== canonical.number);
223+
for (const d of dupes) {
224+
await github.rest.issues.createComment({ owner, repo, issue_number: d.number, body: `DUPLICATE → canonical thread: #${canonical.number} (${canonical.html_url})\nClosing to keep a single operational timeline.` });
225+
await github.rest.issues.update({ owner, repo, issue_number: d.number, state: "closed" });
226+
}
227+
core.setOutput("number", canonical.number);
228+
core.setOutput("html_url", canonical.html_url);
229+
230+
- name: Update ops doc with canonical thread (SSOT)
231+
if: always() && env.SELECTED_SCENARIO == 'all' && github.event_name == 'schedule'
232+
run: |
233+
OPS="LLM_Unified/ion-mentoring/docs/ops/load-test.md"
234+
mkdir -p "$(dirname "$OPS")"
235+
CANON_NUM="${{ steps.issue.outputs.number }}"
236+
CANON_URL="${{ steps.issue.outputs.html_url }}"
237+
if [ ! -f "$OPS" ]; then
238+
cat > "$OPS" <<'MD'
239+
# 부하 테스트 운영 기록 (SSOT)
240+
## Canonical Issue Thread
241+
- Thread: (unset)
242+
MD
243+
fi
244+
if grep -qE '^- Thread:' "$OPS"; then
245+
perl -0777 -i -pe "s/^- Thread:.*\$/- Thread: #$CANON_NUM ($CANON_URL)/m" "$OPS"
246+
else
247+
printf "\n## Canonical Issue Thread\n- Thread: #%s (%s)\n" "$CANON_NUM" "$CANON_URL" >> "$OPS"
248+
fi
249+
250+
- name: Comment weekly report to canonical issue
206251
if: always() && env.SELECTED_SCENARIO == 'all' && github.event_name == 'schedule'
207252
uses: actions/github-script@v7
208253
with:
209254
script: |
210255
const fs = require('fs');
211-
const THREAD_LABEL = 'load-test-thread';
212-
const THREAD_TITLE = 'Load Test Weekly Reports (Thread)';
213-
const owner = context.repo.owner;
214-
const repo = context.repo.repo;
256+
const owner = context.repo.owner, repo = context.repo.repo;
257+
const issue_number = Number("${{ steps.issue.outputs.number }}");
215258
const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${context.runId}`;
216-
const report = fs.readFileSync('LLM_Unified/ion-mentoring/outputs/weekly_report.md', 'utf8');
217-
const search = await github.rest.search.issuesAndPullRequests({ q: `repo:${owner}/${repo} is:issue label:${THREAD_LABEL}` });
218-
let issueNumber = search.data.items.length > 0 ? search.data.items[0].number : (await github.rest.issues.create({ owner, repo, title: THREAD_TITLE, body: '# Weekly Load Test Reports\nLiving thread for weekly results.', labels: [THREAD_LABEL, 'ops'] })).data.number;
219-
await github.rest.issues.createComment({ owner, repo, issue_number: issueNumber, body: `## Weekly All Summary\n- Run: ${runUrl}\n\n${report}` });
259+
const report = fs.existsSync('LLM_Unified/ion-mentoring/outputs/weekly_report.md') ? fs.readFileSync('LLM_Unified/ion-mentoring/outputs/weekly_report.md', 'utf8') : "(weekly_report.md missing)";
260+
await github.rest.issues.createComment({ owner, repo, issue_number, body: `## Weekly All Summary\n- Run: ${runUrl}\n\n${report}` });
261+
262+
- name: Commit ops SSOT update
263+
if: always() && env.SELECTED_SCENARIO == 'all' && github.event_name == 'schedule'
264+
run: |
265+
git config --local user.email "action@github.com"
266+
git config --local user.name "GitHub Action"
267+
git add LLM_Unified/ion-mentoring/docs/ops/load-test.md
268+
git diff --quiet && git diff --staged --quiet || (git commit -m "Ops: pin canonical load-test issue thread (SSOT)" && git push origin main)
220269
221270
- name: 테스트 결과 요약 생성
222271
if: always()

0 commit comments

Comments
 (0)