Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
69e46c2
Initial commit
don-petry Mar 21, 2026
e39adfd
Install BMad Method v6.2.0 with Claude Code integration
claude Mar 21, 2026
90114a0
Add TalkTerm Product Requirements Document
don-petry Mar 21, 2026
b99c0e8
Enhance PRD v1.1 with multi-agent review findings
Mar 21, 2026
b62c500
chore: add Dependabot with auto-merge via GitHub App (#3)
don-petry Mar 23, 2026
0de4f76
Bump actions/create-github-app-token from 1 to 3 (#4)
dependabot[bot] Mar 24, 2026
fd03cb3
Add UX design spec, architecture, research, and Figma screen mockups
Mar 23, 2026
4617e2e
Enhance UX designs with workspace selection, contextual writeback, pr…
Mar 24, 2026
61009be
Address PR review: fix contradictions, remove capture scripts, fix JS…
Mar 24, 2026
e02c7a2
fix: configure CodeQL to scan Python only (#6)
don-petry Mar 24, 2026
30f401d
Add comprehensive story files for all 12 epics (45 stories)
Mar 24, 2026
18b905e
Address PR review: fix FR references, story count, and installer term…
Mar 25, 2026
3aa749b
chore: add CodeRabbit config for AI-powered PR reviews (#11)
don-petry Mar 26, 2026
8cc2b53
chore: enable SonarCloud code quality analysis (#10)
don-petry Mar 26, 2026
4195476
chore: add ECC integration, TEA module, and slim CLAUDE.md
Mar 26, 2026
fa4c563
fix: address PR review comments and SonarCloud exclusions
Mar 26, 2026
0cb8f57
chore: refine CodeRabbit config to exclude non-code directories (#13)
don-petry Mar 26, 2026
260edfc
chore: refine SonarCloud exclusions for non-code directories (#14)
don-petry Mar 26, 2026
0c59147
Add Claude Code GitHub Action (#15)
don-petry Mar 27, 2026
ddc3d00
fix: address OpenSSF Scorecard findings (#22)
don-petry Mar 28, 2026
f8207d7
Import org-wide AGENTS.md, remove duplicated standards (#23)
don-petry Mar 28, 2026
e49c3bc
chore(deps): bump github/codeql-action from 3.35.1 to 4.35.1 (#27)
dependabot[bot] Apr 1, 2026
a4880dd
chore(deps): bump SonarSource/sonarqube-scan-action from 6.0.0 to 7.0…
dependabot[bot] Apr 1, 2026
13dfb60
chore(deps): bump actions/checkout from 4.3.1 to 6.0.2 (#24)
dependabot[bot] Apr 1, 2026
f60222e
ci: skip Claude Code reviewer on Dependabot PRs (#28)
don-petry Apr 1, 2026
18e8c7c
ci: move Dependabot exclusion to step-level in Claude workflow (#30)
don-petry Apr 1, 2026
3347967
ci: switch auto-merge to --auto and resolve AI reviewer threads (#31)
don-petry Apr 1, 2026
65b7471
chore(deps): bump anthropics/claude-code-action from 1.0.80 to 1.0.82…
dependabot[bot] Apr 1, 2026
8a59d1b
chore: add Dependabot security-only update config (#32)
don-petry Apr 4, 2026
98c580b
chore(deps): bump anthropics/claude-code-action from 1.0.83 to 1.0.88…
dependabot[bot] Apr 4, 2026
99f9164
chore(deps): bump SonarSource/sonarqube-scan-action from 7.0.0 to 7.1…
dependabot[bot] Apr 4, 2026
c5dc652
chore: enable Claude issue trigger per org CI standard (#48)
don-petry Apr 5, 2026
27a31d1
fix: add checkout step to Claude workflow for issue-triggered mode (#49)
don-petry Apr 5, 2026
396c54f
feat: add dependabot update-and-merge workflow (#54)
don-petry Apr 6, 2026
fbb43c6
feat: split Claude workflow into interactive + issue automation jobs …
don-petry Apr 6, 2026
9453f7f
feat: switch to org-level reusable Claude Code workflow (#62)
don-petry Apr 6, 2026
0edb445
feat: add BMAD Analyst feature ideation workflow (#60)
don-petry Apr 6, 2026
21c417c
debug: enable display_report and show_full_output for test run
Apr 6, 2026
5894399
chore: add CODEOWNERS file for code review enforcement
github-actions[bot] Apr 6, 2026
a903760
fix: use workflow GITHUB_TOKEN so discussions:write permission applies
Apr 6, 2026
33719db
refactor: use org-wide reusable feature-ideation workflow (#68)
don-petry Apr 7, 2026
799e583
fix: sync dependency-audit.yml with org template (closes #42) (#80)
don-petry Apr 8, 2026
ef17e5f
fix: rename codeql workflow and add javascript-typescript + actions m…
don-petry Apr 8, 2026
3d3706b
ci: add agent-shield.yml workflow (#78)
don-petry Apr 8, 2026
35eca8d
chore(workflows): adopt centralized stubs from petry-projects/.github…
don-petry Apr 8, 2026
fc0385f
fix: correct reusable workflow path (remove duplicate .github/) (#135)
don-petry Apr 21, 2026
a7106b7
Revert "fix: correct reusable workflow path (remove duplicate .github…
Apr 21, 2026
11a9c9f
ci: add auto-rebase workflow and check_run trigger to claude.yml
don-petry Apr 21, 2026
d834375
fix: update auto-rebase ref to SHA containing the reusable workflow
don-petry Apr 21, 2026
b382b74
fix: pin auto-rebase.yml to canonical @v1 stub per org standard (#139)
don-petry Apr 25, 2026
5e52720
chore(ci): remove stray codeql.yml workflow (#115)
don-petry Apr 26, 2026
aa55ab2
fix(compliance): add CI secret-scan job and org .gitignore baseline (…
don-petry Apr 26, 2026
eeb345b
chore(security): remove drift codeql.yml, enable GitHub-managed defau…
don-petry Apr 26, 2026
b88d195
chore(settings): add .github/settings.yml to codify repo settings (#118)
don-petry Apr 26, 2026
acfae95
fix(ci): align dependabot-rebase with org standard + confirm allow_au…
don-petry Apr 26, 2026
9bd8092
fix(ci): pin dependency-audit reusable workflow to SHA (#120)
don-petry Apr 26, 2026
df7c3c2
fix(ci): pin feature-ideation reusable workflow to SHA (#122)
don-petry Apr 26, 2026
9d66e48
fix(ci): pin agent-shield reusable workflow to SHA (#123)
don-petry Apr 26, 2026
33e303d
fix: pin dependabot-automerge reusable workflow to SHA (#124)
don-petry Apr 26, 2026
1f478b8
fix(ci): pin agent-shield reusable workflow to SHA (#126)
don-petry Apr 26, 2026
214e8ad
chore: add bot accounts to CODEOWNERS for auto-merge support
don-petry May 3, 2026
c5708ac
chore: standardize CODEOWNERS on @petry-projects/org-leads (#160)
don-petry May 4, 2026
c492d18
chore(deps): bump SonarSource/sonarqube-scan-action from 7.1.0 to 8.0…
dependabot[bot] May 7, 2026
288907c
chore(deps): bump petry-projects/.github/.github/workflows/dependabot…
dependabot[bot] May 7, 2026
98fa799
chore(deps): bump petry-projects/.github/.github/workflows/dependency…
dependabot[bot] May 7, 2026
8d82286
chore(deps): bump petry-projects/.github/.github/workflows/agent-shie…
dependabot[bot] May 7, 2026
6f65a54
chore(deps): bump petry-projects/.github/.github/workflows/feature-id…
dependabot[bot] May 7, 2026
d66ccf7
chore: sync org-standard pr-review-mention.yml stub from petry-projec…
don-petry May 11, 2026
51632aa
fix: pin pr-review-mention reusable to SHA d3d768d (#173)
don-petry May 13, 2026
d77dcd8
feat(dev-lead): adopt dev-lead agent (Phase 8 cross-repo rollout)
don-petry May 15, 2026
b8d4d6b
chore(dev-lead): remove claude.yml — replaced by dev-lead.yml (#176)
don-petry May 16, 2026
d539787
chore: sync org-standard pr-review-mention.yml stub from petry-projec…
don-petry May 19, 2026
5d64a74
chore: sync org-standard pr-review-mention.yml stub from petry-projec…
don-petry May 19, 2026
6b6c9c7
feat: implement issue #171 — Compliance: secret_scanning_ai_detection…
don-petry May 20, 2026
0d94069
feat: implement issue #162 — Compliance: codeowners-no-catchall (#182)
don-petry May 20, 2026
2a0c48a
feat: implement issue #174 — Compliance: unpinned-actions-dev-lead.ym…
don-petry May 20, 2026
bfa4e2d
feat: implement issue #172 — Compliance: secret_scanning_non_provider…
don-petry May 21, 2026
438b49c
feat: implement issue #164 — Compliance: check-suite-auto-trigger-347…
don-petry May 21, 2026
f66abc9
feat: implement issue #175 — Compliance: non-stub-pr-review-mention.y…
don-petry May 21, 2026
c63358e
feat: implement issue #148 — Compliance: non-stub-dependency-audit.ym…
don-petry May 21, 2026
c5c451f
feat: implement issue #144 — Compliance: unpinned-actions-auto-rebase…
don-petry May 21, 2026
ba05527
feat: implement issue #149 — Compliance: non-stub-dependabot-automerg…
don-petry May 21, 2026
480d2fb
feat: implement issue #150 — Compliance: non-stub-agent-shield.yml (#…
don-petry May 21, 2026
c8db307
feat: implement issue #88 — Compliance: unpinned-actions-dependabot-r…
don-petry May 21, 2026
fc4d9cd
feat: implement issue #151 — Compliance: non-stub-feature-ideation.ym…
don-petry May 21, 2026
49f43cd
feat: implement issue #161 — Compliance: codeowners-org-leads-not-fir…
don-petry May 21, 2026
25f7cc7
feat: add copilot-setup-steps.yml for Copilot cloud agent
don-petry May 21, 2026
384497a
fix: correct fork guard and instructions dir check in copilot-setup-s…
don-petry May 21, 2026
e7792e3
fix: make copilot setup workflow docs-only for current TalkTerm main
don-petry May 21, 2026
78be465
feat: implement issue #200 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry May 21, 2026
460893f
feat: implement issue #86 — Compliance: unpinned-actions-claude.yml (…
don-petry May 21, 2026
a05e268
feat: implement issue #198 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry May 21, 2026
c7b99ed
feat: implement issue #163 — Compliance: check-suite-auto-trigger-123…
don-petry May 21, 2026
9793fad
CI Failure Analyst: Add automated diagnostics (#214)
don-petry May 23, 2026
e4070a4
rollout: deploy pr-review-mention standard workflow (#236)
don-petry May 31, 2026
503552b
feat: add pr-auto-review.yml workflow (compliance automation Phase 2)
don-petry Jun 1, 2026
9259451
deploy: add pr-review.yml workflow
don-petry Jun 3, 2026
94418fd
fix: explicitly map all secrets in pr-review thin stub
don-petry Jun 4, 2026
dfcf249
fix(dev-lead): align to @main — drop broken concurrency + grant statu…
don-petry Jun 8, 2026
ec5f98c
chore: sync org-standard add-to-project.yml stub from petry-projects/…
don-petry Jun 18, 2026
36450d3
chore(deps): bump gitleaks/gitleaks-action from 2.3.9 to 3.0.0 (#238)
dependabot[bot] Jun 20, 2026
36c7407
feat: implement issue #272 — Compliance: dev-lead-stub-pin (#297)
don-petry Jun 20, 2026
f2b5b0d
ci(dev-lead): enable dev-lead-issue-retry dispatch type (#781) (#301)
don-petry Jun 20, 2026
0e3d95e
feat: implement issue #217 — Compliance: codeowners-org-leads-not-fir…
don-petry Jun 20, 2026
bdd4be7
feat: implement issue #220 — Compliance: non-stub-auto-rebase.yml (#303)
don-petry Jun 20, 2026
7155bb7
feat: implement issue #296 — Compliance: check-suite-prefs-unreadable…
don-petry Jun 20, 2026
2a26b5d
feat: implement issue #274 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 20, 2026
31c07bf
feat: implement issue #207 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 20, 2026
5a269ec
feat: implement issue #239 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 20, 2026
afbfb36
feat: implement issue #199 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 20, 2026
be50691
feat: implement issue #204 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 20, 2026
158a822
chore: sync 6 org-standard workflow stub(s) from petry-projects/.gith…
don-petry Jun 20, 2026
85296dd
chore(deps): bump SonarSource/sonarqube-scan-action from 8.0.0 to 8.1…
dependabot[bot] Jun 20, 2026
1065a73
feat(copilot): add repo-level Copilot instruction files (#203)
don-petry Jun 20, 2026
c5f8c7d
chore(deps): bump petry-projects/.github/.github/workflows/feature-id…
dependabot[bot] Jun 20, 2026
28946af
ci(dev-lead): pin caller to @dev-lead/ring1 (staged canary) (#306)
don-petry Jun 21, 2026
5d907d1
fix(pr-review): bump TalkTerm caller pin from v1.5.5 to pr-review/sta…
don-petry Jun 22, 2026
ebb701d
feat: implement issue #226 — Compliance: check-suite-auto-trigger-123…
don-petry Jun 22, 2026
df3833a
feat: implement issue #219 — Compliance: non-stub-dev-lead.yml (#258)
don-petry Jun 22, 2026
a6ccd55
feat: implement issue #227 — Compliance: check-suite-auto-trigger-347…
don-petry Jun 22, 2026
d5fb535
chore(deps): bump petry-projects/.github-private/.github/workflows/ci…
dependabot[bot] Jun 22, 2026
98a4006
chore(deps): bump SonarSource/sonarqube-scan-action from 8.1.0 to 8.2…
dependabot[bot] Jun 22, 2026
b9846fb
chore(deps): bump petry-projects/.github/.github/workflows/feature-id…
dependabot[bot] Jun 22, 2026
dd204ac
chore(deps): bump petry-projects/.github-private/.github/workflows/pr…
dependabot[bot] Jun 23, 2026
4c0ccdc
chore(deps): bump petry-projects/.github/.github/workflows/dependabot…
dependabot[bot] Jun 23, 2026
cabc96a
chore(deps): bump petry-projects/.github/.github/workflows/agent-shie…
dependabot[bot] Jun 23, 2026
8370146
chore(deps): bump petry-projects/.github/.github/workflows/dependency…
dependabot[bot] Jun 23, 2026
32577a6
feat: implement issue #285 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 23, 2026
6c076c7
feat: implement issue #314 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jun 24, 2026
4659009
chore: repin centralized stubs to ring1 ring channel (#870) (#316)
don-petry Jun 25, 2026
cfbc477
chore: repin dev-lead stub to the dev-lead/stable channel tag (#482) …
don-petry Jun 25, 2026
f426851
chore: repin dev-lead stub to dev-lead/stable channel (#482) (#319)
don-petry Jun 25, 2026
0368b8a
fix(pr-review): use moving @pr-review/stable tag (stop Dependabot ver…
don-petry Jun 28, 2026
aedf672
ci: inline NOSONAR(S7637) markers on first-party caller stubs (#549 c…
don-petry Jun 30, 2026
dc52d50
chore(deps): bump petry-projects/.github/.github/workflows/feature-id…
dependabot[bot] Jun 30, 2026
e2c03f2
chore: enroll TalkTerm in idea→initiative pipeline (ring1) (#331)
don-petry Jun 30, 2026
5e0bf6f
chore(deps): bump petry-projects/.github-private/.github/workflows/ci…
dependabot[bot] Jun 30, 2026
671453c
chore: re-sync initiative stubs to S7635 inline marker (post .github#…
don-petry Jul 1, 2026
0af6809
feat: implement issue #222 — Compliance: non-stub-feature-ideation.ym…
don-petry Jul 2, 2026
9320269
feat: implement issue #340 — Compliance: non-stub-feature-ideation.ym…
don-petry Jul 3, 2026
4882270
feat: implement issue #343 — SonarCloud: misc cleanup (mixed findings…
don-petry Jul 3, 2026
f9e6b18
feat: implement issue #342 — SonarCloud: shell script hygiene cleanup…
don-petry Jul 3, 2026
a78a3cb
ci: repin ci-failure-analyst → @ci-failure-analyst/stable (#1159) (#352)
don-petry Jul 11, 2026
b849a23
chore(deps): bump petry-projects/.github/.github/workflows/feature-id…
dependabot[bot] Jul 11, 2026
c51b05d
ci(#614): repin feature-ideation onto ring channels (#353)
don-petry Jul 11, 2026
1699bf2
ci(#651): repin add-to-project → @add-to-project/ring1 (#354)
don-petry Jul 11, 2026
6f1a6c2
ci: migrate pr-auto-review → @pr-auto-review/ring1 (canary) (#355)
don-petry Jul 11, 2026
dda2277
chore: sync 8 org-standard workflow stub(s) from petry-projects/.gith…
don-petry Jul 13, 2026
9e9d4d5
chore: major-scope repin self-consumer stubs [#657 F5] (#359)
don-petry Jul 14, 2026
42af34e
fix: re-pin agent_ref inputs to v-form (missed by #657 uses:-only re-…
don-petry Jul 14, 2026
035d032
ci: inline NOSONAR(S7635) markers on secrets:inherit caller stubs (#362)
don-petry Jul 14, 2026
4003b17
feat: implement issue #374 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jul 18, 2026
74d085a
feat: implement issue #375 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jul 18, 2026
a741c0e
feat: implement issue #380 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jul 19, 2026
651a2c6
feat: implement issue #378 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jul 19, 2026
0debd2b
chore: insert org secrets baseline in .gitignore (#387)
don-petry Jul 20, 2026
c77e865
feat: implement issue #372 — Compliance: stub-surface-drift-pr-auto-r…
don-petry Jul 20, 2026
c46adf3
feat: implement issue #368 — Compliance: ruleset-drift-pr-quality-all…
don-petry Jul 20, 2026
ab86f2b
chore(deps): bump actions/setup-node from 6.4.0 to 7.0.0 (#389)
dependabot[bot] Jul 20, 2026
2e4a886
chore(deps): bump SonarSource/sonarqube-scan-action from 8.2.0 to 8.2…
dependabot[bot] Jul 20, 2026
9edcc4d
feat: implement issue #369 — Compliance: dev-lead-stub-pin (#391)
don-petry Jul 20, 2026
cdbe8e6
feat: implement issue #370 — Compliance: dev-lead-stub-agent-ref (#395)
don-petry Jul 21, 2026
054abf2
chore: sync 2 org-standard workflow stub(s) from petry-projects/.gith…
don-petry Jul 21, 2026
a12404d
chore: sync 1 org-standard workflow stub(s) from petry-projects/.gith…
don-petry Jul 22, 2026
f43be69
feat: implement issue #401 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Jul 22, 2026
141e200
chore: sync 2 org-standard workflow stub(s) from petry-projects/.gith…
don-petry Jul 22, 2026
0573a8c
feat: implement issue #412 — Compliance: ci-concurrency-missing-sha (…
don-petry Jul 24, 2026
1dbdaba
feat: implement issue #385 — Migrate pr-review.yml caller to `secrets…
don-petry Aug 2, 2026
184393e
feat: implement issue #349 — SonarCloud: shell script hygiene (#396)
don-petry Aug 2, 2026
440e47a
feat: implement issue #406 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 2, 2026
54550ad
feat: implement issue #371 — Compliance: stub-surface-drift-feature-i…
don-petry Aug 2, 2026
be59c89
feat: implement issue #430 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 13, 2026
5f03d52
chore(deps): bump actions/setup-java from 5.2.0 to 5.7.0 (#419)
dependabot[bot] Aug 13, 2026
4c616a7
feat: implement issue #425 — Compliance: ruleset-drift-pr-quality-req…
don-petry Aug 18, 2026
de50db1
feat: implement issue #424 — Compliance: ruleset-drift-pr-quality-dis…
don-petry Aug 18, 2026
7c70e41
feat: implement issue #428 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 18, 2026
192e5d5
feat: implement issue #436 — SonarCloud: shell script hygiene (#437)
don-petry Aug 18, 2026
1f8e38a
feat: implement issue #438 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 19, 2026
95fab1c
feat: implement issue #439 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 19, 2026
242b6de
feat: implement issue #445 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 20, 2026
4d0aa12
feat: implement issue #447 — [Fleet Monitor] petry-projects/TalkTerm …
don-petry Aug 21, 2026
0eb8d16
feat: implement issue #454 — Compliance: ruleset-drift-pr-quality-req…
donpetry-bot Aug 21, 2026
d635830
Merge branch 'main' into dev-lead/issue-454-20260821-1308
don-petry Sep 1, 2026
f6171e5
chore: dev-lead update (review-changes) [skip ci-relay]
donpetry-bot Sep 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ repository:
# The ruleset JSON's source of truth lives in petry-projects/.github
# (standards/rulesets/pr-quality.json) and is applied org-wide by apply-rulesets.sh.
# scripts/apply-repo-settings.sh additionally reconciles allowed_merge_methods to
# [squash], require_last_push_approval to true, and dismiss_stale_reviews_on_push
# to true on push to main + weekly, so drift is caught between compliance audits
# (compliance: ruleset-drift-pr-quality-require_last_push_approval,
# ruleset-drift-pr-quality-dismiss_stale_reviews_on_push).
#
# dismiss_stale_reviews_on_push=true drops existing approvals when new commits are
# pushed, so a merge always reflects a review of the exact code being merged.
# [squash] and require_last_push_approval to true on push to main + weekly, so
# drift is caught between compliance audits (compliance:
# ruleset-drift-pr-quality-require_last_push_approval).

# --- Check suite auto-trigger ---
# Standard: https://github.com/petry-projects/.github/blob/main/standards/github-settings.md
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/apply-repo-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# compliance audits. Also triggerable manually for out-of-band remediation.
# Reconciles: security_and_analysis settings (secret_scanning_ai_detection, etc.),
# check-suite auto-trigger preferences, and the pr-quality ruleset's
# allowed_merge_methods (squash-only) and dismiss_stale_reviews_on_push (true).
# allowed_merge_methods (squash-only), dismiss_stale_reviews_on_push (true), and
# require_last_push_approval (true).
#
# Token: GH_PAT_WORKFLOWS (classic PAT with repo scope).
# `administration` is not a valid GITHUB_TOKEN scope in Actions; and the
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@ jobs:
bash scripts/test-copilot-setup-steps-workflow.sh
bash scripts/test-sonarcloud-workflow.sh
bash scripts/test-sonarcloud-workflow.test.sh
bash scripts/apply-repo-settings.test.sh
37 changes: 19 additions & 18 deletions scripts/apply-repo-settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,17 @@
}

# pr_quality_reconcile_payload <ruleset_json>
# Builds the PUT payload that reconciles the pr-quality ruleset's pull_request
# rule to the codified standard — squash-only merges, require_last_push_approval,
# and dismiss_stale_reviews_on_push all set to their standard values — while
# preserving the ruleset's name, target, enforcement, bypass_actors, conditions,
# and any non-pull_request rules verbatim. Absent bypass_actors default to an
# empty array. Pure and side-effect-free so it can be unit-tested independently
# of the GitHub API; apply_pr_quality_ruleset delegates the transform here.
# Builds the PUT body that reconciles the pr-quality ruleset's pull_request rule
# to the codified standard: allowed_merge_methods=[squash],
# require_last_push_approval=true, dismiss_stale_reviews_on_push=true. Structural
# fields (name, target, enforcement, bypass_actors, conditions) are carried over
# from the current ruleset; absent bypass_actors default to []. Non-pull_request
# rules pass through unchanged. Pure and side-effect-free so it can be
# unit-tested without hitting the API.
pr_quality_reconcile_payload() {

Check warning on line 204 in scripts/apply-repo-settings.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add an explicit return statement at the end of the function.

See more on https://sonarcloud.io/project/issues?id=petry-projects_TalkTerm&issues=AaAkd71zauFKiHjiuOHU&open=AaAkd71zauFKiHjiuOHU&pullRequest=456
local json="${1:-}"
if [[ -z "$json" ]]; then
return 1
fi
printf '%s' "$json" | jq \
--arg method "$PR_QUALITY_MERGE_METHOD" \
--argjson rlpa "$PR_QUALITY_REQUIRE_LAST_PUSH_APPROVAL" \
--argjson ds "$PR_QUALITY_DISMISS_STALE_REVIEWS" '
local ruleset="${1:-}"
printf '%s' "$ruleset" | jq \
--arg method "$PR_QUALITY_MERGE_METHOD" '
{
name: .name,
target: .target,
Expand All @@ -219,8 +214,7 @@
rules: [
(.rules // [])[]
| if .type == "pull_request"
then .parameters.allowed_merge_methods = [$method]
| .parameters = ((.parameters // {}) + {require_last_push_approval: $rlpa, dismiss_stale_reviews_on_push: $ds})
then .parameters = ((.parameters // {}) + {allowed_merge_methods: [$method], require_last_push_approval: true, dismiss_stale_reviews_on_push: true})
else . end
Comment thread
don-petry marked this conversation as resolved.
Resolved
]
}'
Comment thread
don-petry marked this conversation as resolved.
Resolved
Expand Down Expand Up @@ -298,8 +292,15 @@
return 0
fi

# Refetch immediately before PUT to narrow the GET-then-PUT race window.
local fresh_ruleset
if ! fresh_ruleset=$(gh api "repos/${repo}/rulesets/${ruleset_id}" 2>/dev/null) || [[ -z "$fresh_ruleset" ]]; then
echo " could not re-read ruleset ${ruleset_id} before update — skipping"
return 0
fi

local payload
if ! payload=$(pr_quality_reconcile_payload "$ruleset"); then
if ! payload=$(pr_quality_reconcile_payload "$fresh_ruleset"); then
echo " failed to generate payload for ruleset update"
return 1
fi
Expand Down
88 changes: 51 additions & 37 deletions scripts/apply-repo-settings.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,48 +105,62 @@ assert_eq "pr_quality_require_last_push_approval_status: empty string -> missing
"$MISSING" "$(pr_quality_require_last_push_approval_status "")"

# ── pr_quality_reconcile_payload ──────────────────────────────────────────────
# A ruleset whose pull_request rule has drifted on every reconciled parameter,
# alongside a non-pull_request rule and top-level metadata that must survive the
# transform untouched.
ruleset_drifted_full='{"name":"pr-quality","target":"branch","enforcement":"active","bypass_actors":[{"actor_id":5,"actor_type":"Team"}],"conditions":{"ref_name":{"include":["~DEFAULT_BRANCH"],"exclude":[]}},"rules":[{"type":"required_status_checks","parameters":{"strict_required_status_checks_policy":true}},{"type":"pull_request","parameters":{"allowed_merge_methods":["merge","rebase","squash"],"require_last_push_approval":false,"dismiss_stale_reviews_on_push":false}}]}'

# A fully-drifted ruleset: multiple merge methods allowed, both review-safety
# parameters false, plus structural fields and a second (non-pull_request) rule
# that must pass through untouched.
ruleset_drifted_full='{
"name":"pr-quality",
"target":"branch",
"enforcement":"active",
"bypass_actors":[{"actor_id":1,"actor_type":"Team","bypass_mode":"always"}],
"conditions":{"ref_name":{"include":["~DEFAULT_BRANCH"],"exclude":[]}},
"rules":[
{"type":"pull_request","parameters":{"allowed_merge_methods":["merge","rebase","squash"],"require_last_push_approval":false,"dismiss_stale_reviews_on_push":false}},
{"type":"required_status_checks","parameters":{"strict_required_status_checks_policy":true}}
]
}'
payload_drifted=""
if ! payload_drifted="$(pr_quality_reconcile_payload "$ruleset_drifted_full")"; then
echo "Failed to reconcile payload" >&2
exit 1
fi
payload_drifted="$(pr_quality_reconcile_payload "$ruleset_drifted_full")"
Comment thread
don-petry marked this conversation as resolved.
Resolved

assert_eq "pr_quality_reconcile_payload: dismiss_stale_reviews_on_push drifted -> true" \
"true" "$(printf '%s' "$payload_drifted" | jq -r '.rules[] | select(.type=="pull_request") | .parameters.dismiss_stale_reviews_on_push')"
assert_eq "pr_quality_reconcile_payload: allowed_merge_methods -> squash-only" \
"squash" "$(printf '%s' "$payload_drifted" | jq -r '.rules[] | select(.type=="pull_request") | .parameters.allowed_merge_methods | join(",")')"
assert_eq "pr_quality_reconcile_payload: require_last_push_approval -> true" \
assert_eq "pr_quality_reconcile_payload: require_last_push_approval reconciled to true" \
"true" "$(printf '%s' "$payload_drifted" | jq -r '.rules[] | select(.type=="pull_request") | .parameters.require_last_push_approval')"
assert_eq "pr_quality_reconcile_payload: non-pull_request rule preserved unchanged" \
"true" "$(printf '%s' "$payload_drifted" | jq -r '.rules[] | select(.type=="required_status_checks") | .parameters.strict_required_status_checks_policy')"
assert_eq "pr_quality_reconcile_payload: top-level metadata (name) preserved" \
assert_eq "pr_quality_reconcile_payload: dismiss_stale_reviews_on_push reconciled to true" \
"true" "$(printf '%s' "$payload_drifted" | jq -r '.rules[] | select(.type=="pull_request") | .parameters.dismiss_stale_reviews_on_push')"
assert_eq "pr_quality_reconcile_payload: allowed_merge_methods reconciled to squash-only" \
'["squash"]' "$(printf '%s' "$payload_drifted" | jq -c '.rules[] | select(.type=="pull_request") | .parameters.allowed_merge_methods')"
assert_eq "pr_quality_reconcile_payload: preserves ruleset name" \
"pr-quality" "$(printf '%s' "$payload_drifted" | jq -r '.name')"
assert_eq "pr_quality_reconcile_payload: enforcement preserved" \
assert_eq "pr_quality_reconcile_payload: preserves target" \
"branch" "$(printf '%s' "$payload_drifted" | jq -r '.target')"
assert_eq "pr_quality_reconcile_payload: preserves enforcement" \
"active" "$(printf '%s' "$payload_drifted" | jq -r '.enforcement')"
assert_eq "pr_quality_reconcile_payload: conditions preserved" \
"~DEFAULT_BRANCH" "$(printf '%s' "$payload_drifted" | jq -r '.conditions.ref_name.include[0]')"
assert_eq "pr_quality_reconcile_payload: bypass_actors preserved" \
"5" "$(printf '%s' "$payload_drifted" | jq -r '.bypass_actors[0].actor_id')"

# When the ruleset has no bypass_actors key, the payload defaults it to an empty
# array (matching apply_pr_quality_ruleset's original behavior).
ruleset_no_bypass='{"name":"pr-quality","target":"branch","enforcement":"active","conditions":{},"rules":[{"type":"pull_request","parameters":{"dismiss_stale_reviews_on_push":false}}]}'
assert_eq "pr_quality_reconcile_payload: absent bypass_actors -> empty array" \
"0" "$(printf '%s' "$(pr_quality_reconcile_payload "$ruleset_no_bypass")" | jq -r '.bypass_actors | length')"
assert_eq "pr_quality_reconcile_payload: reconciles dismiss even when parameter absent-defaulted" \
"true" "$(printf '%s' "$(pr_quality_reconcile_payload "$ruleset_no_bypass")" | jq -r '.rules[] | select(.type=="pull_request") | .parameters.dismiss_stale_reviews_on_push')"

# Empty input must return a non-zero exit so callers can detect failure.
if pr_quality_reconcile_payload "" >/dev/null 2>&1; then
fail "pr_quality_reconcile_payload: empty input -> non-zero exit"
else
pass "pr_quality_reconcile_payload: empty input -> non-zero exit"
fi
assert_eq "pr_quality_reconcile_payload: preserves conditions" \
'{"ref_name":{"include":["~DEFAULT_BRANCH"],"exclude":[]}}' \
"$(printf '%s' "$payload_drifted" | jq -c '.conditions')"
assert_eq "pr_quality_reconcile_payload: preserves bypass_actors" \
'[{"actor_id":1,"actor_type":"Team","bypass_mode":"always"}]' \
"$(printf '%s' "$payload_drifted" | jq -c '.bypass_actors')"
assert_eq "pr_quality_reconcile_payload: non-pull_request rule passes through untouched" \
'{"type":"required_status_checks","parameters":{"strict_required_status_checks_policy":true}}' \
"$(printf '%s' "$payload_drifted" | jq -c '.rules[] | select(.type=="required_status_checks")')"

# Ruleset missing bypass_actors and with the pull_request rule's parameters
# entirely absent: the payload must still add the two review-safety params and
# default bypass_actors to [].
ruleset_minimal='{
"name":"pr-quality","target":"branch","enforcement":"active",
"conditions":{"ref_name":{"include":["~DEFAULT_BRANCH"],"exclude":[]}},
"rules":[{"type":"pull_request"}]
}'
payload_minimal=""
payload_minimal="$(pr_quality_reconcile_payload "$ruleset_minimal")"
Comment thread
don-petry marked this conversation as resolved.
Resolved

assert_eq "pr_quality_reconcile_payload: absent bypass_actors defaults to []" \
'[]' "$(printf '%s' "$payload_minimal" | jq -c '.bypass_actors')"
assert_eq "pr_quality_reconcile_payload: adds require_last_push_approval when params absent" \
"true" "$(printf '%s' "$payload_minimal" | jq -r '.rules[] | select(.type=="pull_request") | .parameters.require_last_push_approval')"
assert_eq "pr_quality_reconcile_payload: adds squash-only when params absent" \
'["squash"]' "$(printf '%s' "$payload_minimal" | jq -c '.rules[] | select(.type=="pull_request") | .parameters.allowed_merge_methods')"

# ── resolve_repo ──────────────────────────────────────────────────────────────
assert_eq "resolve_repo: bare name -> org/name" \
Expand Down
Loading