How to Configure GitHub Data Retention Policy

Published
Length
3 min read

Luis Felipe Dias

All posts

A github data retention policy controls how long the platform keeps logs and build files. You set it up by choosing lower time limits at the account and repo levels. Every workflow run creates build outputs, test reports, and text logs. Without clear time limits, these files pile up in cloud storage. Old build files increase storage bills and widen your risk surface. Sensitive details can sit in forgotten build files for months. A clear retention rule deletes old items on a fixed schedule. This

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

A github data retention policy controls how long the platform keeps logs and build files. You set it up by choosing lower time limits at the account and repo levels.

Every workflow run creates build outputs, test reports, and text logs. Without clear time limits, these files pile up in cloud storage. Old build files increase storage bills and widen your risk surface. Sensitive details can sit in forgotten build files for months. A clear retention rule deletes old items on a fixed schedule. This keeps storage tidy and lowers risk across your projects.

How a github data retention policy works

The platform sets rules for build artifacts, workflow logs, and package files. Admins define these rules at the top account level or per repo. When a top-level admin sets a max limit, child repos must follow it. Repo owners can pick a shorter window, but not a longer one.

These rules affect human developers, build bots, and external tools. When a workflow finishes, the timer starts for all saved files. Once the timer ends, the system deletes those logs and files for good. Automated jobs can no longer pull those old build outputs.

Safe setups start with short storage windows for everyday branch builds. Feature branches rarely need build files after a few days. Main branches and release tags may need longer windows for audits. You should also set rules to clean up unused container images. Old test caches should expire fast so they do not waste space. Separating short-lived build files from formal releases keeps your setup clean.

Scoping rules across teams and repos

Different teams have different needs for their build history and logs. Front-end apps might only need three days of test results. Core backend services might need thirty days to check slow bugs. You can group repos by risk level and set rules that fit.

GitHub Actions Security + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Public repos need strict limits to avoid leaking data in logs. Private repos with sensitive code need even tighter rules on build outputs. If a build packs source code into a zip file, delete it fast. Set your top-level rule to the shortest window that works for most teams. Let security leads handle any requests for longer storage windows. Check your storage billing page each month to spot repos that keep too much.

Checking rules and closing runtime gaps

After you set your limits, you must check that they work. Platform audit logs show when an admin changes a retention window. You should stream these audit events to an external log store. Platform audit logs also expire after a set time window. Streaming them out keeps your audit trail safe for long-term review. You should also check that automated cleanups run without errors.

Static storage rules only clean up data after a build finishes. They do not control what happens during an active user session. Once an engineer or bot logs in, static rules cannot inspect live actions. A user with repo rights can still download secrets or sensitive files. If a build log captures emails or phone numbers, anyone with read rights sees them. Static settings also cannot stop a broad database query from a runner. Teams need runtime controls to inspect commands and mask fields like card numbers. Combining storage limits with live session controls gives you much safer operations.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What happens when a retention window ends?

The platform deletes the expired build artifacts and workflow logs right away. Users and bots can no longer download or read those files. You cannot undo this removal once the timer runs out.

Can a repo owner override the top-level account limit?

A repo owner can set a shorter retention period than the account limit. They cannot set a window that exceeds the maximum cap set by admins. This ensures all projects follow the main security rule.

Do repo retention rules keep audit logs forever?

No, the platform removes built-in audit logs after a set period. To keep audit records longer, set up log streaming to your own storage bucket. This gives your security team a lasting record of all account events.

The query runs. The emails stay hidden.