Skip to content

Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.

Harden main branch protection and adapt daily-triage for PR flow

Cobus Greyling38b973b62d66
diff --git a/.github/ruleset-main-protection.json b/.github/ruleset-main-protection.json
new file mode 100644
index 0000000..d011caf
--- /dev/null
+++ b/.github/ruleset-main-protection.json
@@ -0,0 +1,37 @@
+{
+ "name": "protecting main branch",
+ "target": "branch",
+ "enforcement": "active",
+ "conditions": {
+ "ref_name": {
+ "include": ["~DEFAULT_BRANCH"],
+ "exclude": []
+ }
+ },
+ "rules": [
+ { "type": "deletion" },
+ { "type": "non_fast_forward" },
+ {
+ "type": "pull_request",
+ "parameters": {
+ "required_approving_review_count": 0,
+ "dismiss_stale_reviews_on_push": false,
+ "require_code_owner_review": false,
+ "require_last_push_approval": false,
+ "required_review_thread_resolution": false
+ }
+ },
+ {
+ "type": "required_status_checks",
+ "parameters": {
+ "required_status_checks": [
+ { "context": "validate" },
+ { "context": "audit" }
+ ],
+ "strict_required_status_checks_policy": false,
+ "do_not_enforce_on_create": false
+ }
+ }
+ ],
+ "bypass_actors": []
+}
\ No newline at end of file
diff --git a/.github/workflows/daily-triage.yml b/.github/workflows/daily-triage.yml
index c1198d6..01c99e9 100644
--- a/.github/workflows/daily-triage.yml
+++ b/.github/workflows/daily-triage.yml
@@ -7,6 +7,7 @@ on:
permissions:
contents: write
+ pull-requests: write
issues: write
jobs:
@@ -81,13 +82,41 @@ jobs:
Run log: Updated by \`.github/workflows/daily-triage.yml\`. See \`LOOP.md\` for cadence and gates.
EOF
- - name: Commit STATE.md if changed
+ - name: Open PR for STATE.md if changed
+ env:
+ GH_TOKEN: ${{ github.token }}
run: |
- git config user.name "loop-engineering-bot"
+ git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+ if git diff --quiet STATE.md; then
+ echo "No STATE.md changes — skip PR"
+ exit 0
+ fi
+
+ BRANCH="automated/daily-triage-$(date -u +%Y-%m-%d)"
+ git checkout -b "$BRANCH"
git add STATE.md
- git diff --staged --quiet || git commit -m "chore(loop): daily triage update STATE.md [automated]"
- git push || echo "No push needed or nothing to commit"
+ git commit -m "chore(loop): daily triage update STATE.md [automated]"
+ git push -u origin "$BRANCH"
+
+ EXISTING=$(gh pr list --head "${{ github.repository_owner }}:${BRANCH}" --base main --state open --json number -q '.[0].number' 2>/dev/null || true)
+ if [ -n "$EXISTING" ] && [ "$EXISTING" != "null" ]; then
+ echo "PR #$EXISTING already open"
+ PR_NUMBER="$EXISTING"
+ else
+ PR_NUMBER=$(gh pr create \
+ --base main \
+ --head "$BRANCH" \
+ --title "chore(loop): daily triage STATE.md $(date -u +%Y-%m-%d)" \
+ --body "Automated daily triage update from \`daily-triage.yml\`.
+
+ - Loop readiness: **${{ steps.audit.outputs.score }}** (${{ steps.audit.outputs.level }})
+ - Merges automatically when \`validate\` and \`audit\` pass." \
+ --json number -q '.number')
+ fi
+
+ gh pr merge "$PR_NUMBER" --auto --squash --delete-branch
- name: Open weekly loop report issue (Mondays)
if: github.event.schedule == '0 8 * * 1-5' && format('{0}', github.run_attempt) == '1'