insightsengineering / insightsengineering/coverage-action

[Feature Request]: Automatically clean up per-branch directories on the storage branch for deleted branches

Open
#54 0 comments 0 reactions 2 assignees Claimed by @pawelru View on GitHub
enhancement
Dominant language
No language data
Stars
28
Forks
14
PR merge metrics
No merged PRs in 30d

Description

### Feature description

## Description
Currently, the coverage-action uses a dedicated storage branch (`_xml_coverage_reports` by default) to persist coverage reports for diff purposes, with one directory per branch.
Over time, as pull requests are merged and branches deleted, these directories accumulate and are no longer relevant.

## Proposed feature
It would be useful if the action could automatically clean up old per-branch directories corresponding to branches that no longer exist on the remote.

A possible approach:

1. When the action runs (e.g. during a PR build), it fetches the list of directories in the configured storage branch.
2. It also retrieves the list of current remote branches.
3. It compares the two lists.
4. Any directories that don’t match an existing branch name can be safely deleted.
5. The cleanup could then be committed and pushed automatically, or optionally gated behind a configuration flag (e.g. `cleanup-diff-storage: true`).

---

I am not sure if this type of automatic cleanup would be in scope for this action, looking forward to hearing your feedback!

If you feel like this would be useful I can provide a PR.

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct.

### Contribution Guidelines

- [x] I agree to follow this project's Contribution Guidelines.

### Security Policy

- [x] I agree to follow this project's Security Policy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.