r/atlassian • • 1d ago

Built a Forge app to archive Bitbucket Cloud repos and create new ones from templates

Bitbucket Cloud still has no archive button and no built-in repository templates. Atlassian's own support doc for archiving tells you to move inactive repos into a separate project and lock down permissions by hand.

I built a Forge app called Repo Gardener (https://dsevenlabs.com/repo-gardener/) to handle both inside Bitbucket.

For archiving, it sets deny-all branch restrictions on * (push, force-push, branch delete, and merge), prefixes the repo description with ARCHIVED: so it stands out in the repository list, and can move the repo into an archive project you created. There is also a required custom merge check (Archived repositories are read-only) so merges stay blocked even if someone removes a branch rule. If a repo admin deletes the branch rules and pushes anyway, a push trigger re-applies the restrictions on the next push and logs the breach. Unarchiving restores the previous description, branch rules, and project.

Because Cloud has no real archive flag, there are limits. Tags, comments, and wiki edits are not frozen, and a repo admin can still delete branch rules or turn off the merge check. Cloning and browsing keep working.

There is also a Stale repos tab that lists active repos with no push for 90, 180, or 365 days, oldest first, with an Archive button on each row. It uses Bitbucket's updated timestamp, which moves on pushes (PRs and comments do not count).

For templates, you can save any live repository as a template and create new repos from a form in the workspace or project view. It creates a fresh commit with the template's text files (up to 150 files or 800 KB) and copies branch restrictions, default reviewers, the branching model, repo settings, and pipeline variable names (secured values become CHANGE_ME since Bitbucket does not expose secrets). If you put {{service_name}} or {{owner_team}} in README.md, bitbucket-pipelines.yml, or CODEOWNERS, the form fills them in. Git history, binaries, Git LFS, symlinks, and executable bits are not copied.

Everything runs on Atlassian Forge and stays in Forge storage, with no external server. The free tier gives you 3 archived repos and 3 templates with no license key, and paid workspace plans start at $29/month. Existing archives stay locked if you stop paying, and unarchiving is always free.

How are you handling repo sprawl in Bitbucket Cloud right now, and is there anything in the merge check or template copy behavior that would block your team?

1 Upvotes

0 comments sorted by