Skip to content

Commit 32cd41a

Browse files
fix: resolve workflow issues causing infinite empty PR loop
- Fix JSON parsing in ai-website-guardian.yml (downloads task) to properly quote JS object property names before parsing as JSON - Fix malformed bash redirects 2>gh pr merge ... 2>&11 in pr-auto-review.yml and audit-all-pages.yml - Disable auto-merge for empty PRs in both pr-auto-review.yml and audit-all-pages.yml to break the infinite loop - Add local HTTP server step to lighthouse.yml before running Lighthouse CI - Add missing alt attribute to logo img in build.html
1 parent d216200 commit 32cd41a

5 files changed

Lines changed: 32 additions & 15 deletions

File tree

.github/workflows/ai-website-guardian.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,16 @@ jobs:
140140
exit(1)
141141
142142
js_text = editions_match.group(1)
143-
# Convert JS object syntax to valid JSON (single quotes → double quotes)
143+
# Convert JS object syntax to valid JSON
144+
# 1. Quote unquoted property names
145+
js_text = re.sub(r'([{,]\s*)([a-zA-Z_][a-zA-Z0-9_]*)\s*:', r'\1"\2":', js_text)
146+
# 2. Replace single quotes with double quotes (for string values)
147+
# Use a simple heuristic: replace ' with " outside of already-quoted strings
144148
js_text = re.sub(r"'", '"', js_text)
145-
# Convert boolean values
146-
js_text = re.sub(r':\s*true', ': true', js_text)
147-
js_text = re.sub(r':\s*false', ': false', js_text)
148-
# Remove trailing commas before ] and }
149+
# 3. Remove trailing commas before ] and }
149150
js_text = re.sub(r',\s*([\]}])', r'\1', js_text)
151+
# 4. Fix any double-quoted strings that got extra quotes
152+
js_text = re.sub(r'""', '"', js_text)
150153
editions = json.loads(js_text)
151154
issues = []
152155

.github/workflows/audit-all-pages.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,14 @@ except: print('APPROVE')
427427
428428
echo "AI Review: $REVIEW"
429429
if echo "$REVIEW" | grep -qi "APPROVE"; then
430-
gh pr merge "$PR_NUMBER" --merge --auto --delete-branch 2>gh pr merge "$PR_NUMBER" --merge --auto 2>&11 || true
431-
echo "✅ PR auto-merged"
430+
# Only auto-merge if PR has actual changes
431+
PR_FILES=$(gh pr view "$PR_NUMBER" --json files --jq '.files | length' 2>/dev/null || echo "0")
432+
if [ "$PR_FILES" -gt 0 ]; then
433+
gh pr merge "$PR_NUMBER" --merge --auto --delete-branch 2>/dev/null || true
434+
echo "✅ PR auto-merged"
435+
else
436+
echo "⏸ PR approved but not auto-merged (no file changes)"
437+
fi
432438
else
433439
echo "⏸ PR needs manual review"
434440
fi

.github/workflows/lighthouse.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ jobs:
1717
- name: Install Lighthouse CI
1818
run: |
1919
npm install -g @lhci/cli@0.12.x
20+
- name: Start local server
21+
run: |
22+
python3 -m http.server 8080 &
23+
sleep 2
2024
- name: Run Lighthouse CI
2125
run: |
22-
lhci autorun --collect.staticDistDir=. --collect.url=http://localhost:8080/index.html --collect.url=http://localhost:8080/blog.html --collect.url=http://localhost:8080/git-tracker.html --upload.target=temporary-public-storage
26+
lhci autorun --collect.url=http://localhost:8080/index.html --collect.url=http://localhost:8080/blog.html --collect.url=http://localhost:8080/git-tracker.html --upload.target=temporary-public-storage

.github/workflows/pr-auto-review.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ jobs:
6565
6666
DIFF=$(cat /tmp/pr-diff.txt 2>/dev/null)
6767
if [ -z "$DIFF" ]; then
68-
echo "Empty diff — auto-approving"
69-
gh pr review "$PR_NUM" --approve \
70-
--body "_🤖 AI Review (${AI_MODEL})_\n\n**Verdict:** ✅ APPROVE\n**Reason:** No code changes detected (empty diff)." 2>/dev/null || true
71-
gh pr merge "$PR_NUM" --merge --auto --delete-branch 2>gh pr merge "$PR_NUM" --merge --auto 2>&11 || true
68+
echo "Empty diff — skipping auto-merge"
69+
gh pr review "$PR_NUM" --comment \
70+
--body "_🤖 AI Review (${AI_MODEL})_\n\n**Verdict:** ⏸ SKIP\n**Reason:** No code changes detected (empty diff). Auto-merge disabled for empty PRs." 2>/dev/null || true
7271
exit 0
7372
fi
7473
@@ -161,8 +160,13 @@ PYEOF
161160
if [ "$VERDICT" = "APPROVE" ]; then
162161
gh pr review "$PR_NUM" --approve --body "$(echo -e "$COMMENT")" 2>/dev/null || true
163162
echo "✅ PR approved by AI"
164-
# Auto-merge
165-
gh pr merge "$PR_NUM" --merge --auto --delete-branch 2>gh pr merge "$PR_NUM" --merge --auto 2>&11 || true
163+
# Auto-merge only if PR has actual changes
164+
PR_FILES=$(gh pr view "$PR_NUM" --json files --jq '.files | length' 2>/dev/null || echo "0")
165+
if [ "$PR_FILES" -gt 0 ]; then
166+
gh pr merge "$PR_NUM" --merge --auto --delete-branch 2>/dev/null || true
167+
else
168+
echo "⏸ PR approved but not auto-merged (no file changes)"
169+
fi
166170
elif [ "$VERDICT" = "REJECT" ]; then
167171
gh pr review "$PR_NUM" --request-changes --body "$(echo -e "$COMMENT")" 2>/dev/null || true
168172
echo "❌ PR rejected by AI"

build.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
.page-footer a{color:var(--acreetion-green);text-decoration:none}
7171
#log-area{background:var(--acreetion-panel-bg);border:1px solid var(--acreetion-box-border);padding:1rem;font-family:var(--font-mono);font-size:0.85rem;color:var(--acreetion-text);max-height:300px;overflow-y:auto;margin-top:0.5rem;display:none;white-space:pre-wrap}
7272
</style></head><body>
73-
<header class="page-header"><div class="header-content"><a href="index.html" class="logo"><img src="acreetionoslogo.webp" loading="lazy" class="logo-img" width="40" height="40" decoding="auto" loading="eager" fetchpriority="high"><span class="logo-text">Acreetion<span>OS</span></span></a><nav class="main-nav"><a href="index.html">Home</a><a href="flash.html">Downloads</a><a href="build.html" class="btn btn-storm">ISO Builder</a><a href="unofficial.html" class="btn btn-storm" style="background-color:var(--acreetion-purple);color:#fff">Unofficial</a><a href="https://github.com/acreetionos-code/" class="btn btn-storm" style="background-color:#333">GitHub</a></nav></div></header>
73+
<header class="page-header"><div class="header-content"><a href="index.html" class="logo"><img src="acreetionoslogo.webp" alt="AcreetionOS Logo" loading="lazy" class="logo-img" width="40" height="40" decoding="auto" loading="eager" fetchpriority="high"><span class="logo-text">Acreetion<span>OS</span></span></a><nav class="main-nav"><a href="index.html">Home</a><a href="flash.html">Downloads</a><a href="build.html" class="btn btn-storm">ISO Builder</a><a href="unofficial.html" class="btn btn-storm" style="background-color:var(--acreetion-purple);color:#fff">Unofficial</a><a href="https://github.com/acreetionos-code/" class="btn btn-storm" style="background-color:#333">GitHub</a></nav></div></header>
7474

7575
<div class="content-box"><div class="box-header"><h2><i class="bi bi-gear-wide-connected"></i> AcreetionOS ISO Builder</h2></div><div class="box-body">
7676
<p style="margin-bottom:1rem;color:var(--acreetion-text)">Select an edition below and trigger an automated build. The ISO will be compiled in our GitHub Actions pipeline and uploaded to Cloudflare R2. You can watch the build progress in real-time.</p>

0 commit comments

Comments
 (0)