Skip to content

feat: run delete-branch-on-merge setup on copier update too#305

Merged
ichoosetoaccept merged 1 commit intomainfrom
feat/delete-branch-on-merge-on-update
Apr 12, 2026
Merged

feat: run delete-branch-on-merge setup on copier update too#305
ichoosetoaccept merged 1 commit intomainfrom
feat/delete-branch-on-merge-on-update

Conversation

@ichoosetoaccept
Copy link
Copy Markdown
Member

The gh repo edit task that enables delete-branch-on-merge and
auto-merge was copy-only. Projects created before this task was
added never got the setting. Now runs on every copier operation
since it's idempotent and fails silently.

Resolves DOT-480

Closes #

@ichoosetoaccept
Copy link
Copy Markdown
Member Author

ichoosetoaccept commented Apr 12, 2026

@linear
Copy link
Copy Markdown

linear bot commented Apr 12, 2026

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 12, 2026

Greptile Summary

Removes the when: "{{ _copier_operation == 'copy' }}" guard from the gh repo edit task so that delete-branch-on-merge and auto-merge are enabled on every copier operation (copy, update, recopy), not just the initial copy. The command is already safe to run unconditionally — the &&-chained guards (command -v gh, gh repo view) and the trailing || true ensure silent no-ops when gh is absent, no GitHub context exists, or the edit fails.

Confidence Score: 5/5

Safe to merge — single-line guard removal with well-established idempotency via existing CLI guards and || true.

The change is minimal and correct. All remaining findings are P2 or lower (the misleading comment was already flagged in a prior review thread). The command's failure-safe design handles every edge case (no gh, no git, no permissions) cleanly.

No files require special attention.

Important Files Changed

Filename Overview
copier.yml Removes when: copy guard from gh repo edit task so it runs idempotently on all copier operations; command already has safe guards via &&/`

Sequence Diagram

sequenceDiagram
    participant U as User
    participant C as Copier
    participant GH as gh CLI

    U->>C: copier copy / update / recopy
    C->>C: chmod scripts
    C->>C: uv sync --upgrade
    alt update or recopy
        C->>C: prek install (if .git exists)
    end
    C->>GH: command -v gh (check if installed)
    alt gh not found
        GH-->>C: fail → || true (silent skip)
    else gh found
        C->>GH: gh repo view (check GitHub repo context)
        alt not a GitHub repo
            GH-->>C: fail → || true (silent skip)
        else GitHub repo found
            C->>GH: gh repo edit --delete-branch-on-merge --enable-auto-merge
            GH-->>C: success / fail → || true (silent skip)
        end
    end
    alt copy
        C->>U: printf "🎉 Project created!"
    else update or recopy
        C->>U: printf "🎉 Template updated!"
    end
Loading

Reviews (2): Last reviewed commit: "feat: run delete-branch-on-merge setup o..." | Re-trigger Greptile

Base automatically changed from fix/validate-build-command-after-update to main April 12, 2026 22:02
The gh repo edit task that enables delete-branch-on-merge and
auto-merge was copy-only. Projects created before this task was
added never got the setting. Now runs on every copier operation
since it's idempotent and fails silently.

Resolves DOT-480
@ichoosetoaccept ichoosetoaccept force-pushed the feat/delete-branch-on-merge-on-update branch from c435c20 to 4f4d8b2 Compare April 12, 2026 22:04
@ichoosetoaccept ichoosetoaccept merged commit 96c83e4 into main Apr 12, 2026
6 of 11 checks passed
@ichoosetoaccept ichoosetoaccept deleted the feat/delete-branch-on-merge-on-update branch April 12, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant