Skip to main content

GitHub Repository Archiving

Overview

Repositories that have been inactive for a period of time will automatically be archived by this automation. This preserves the repository, prevents further changes, prevents Dependabot updates and stops any scheduled GH actions from running. There is an allow list for repositories that should not be archived.

This GitHub Action workflow file for the MoJ GH Org and AS GH Org run a Python script daily to archive inactive GitHub repositories. There are two ways to configure this process:

  • Add/remove a repository to the allow list within the script file so that it filters out the repository from this process.
  • Alter the inactive time that determines when a repository is ready to be archived.

Changing the archive inactivity time

Inside the Python file is a DateTime calculation datetime.now() - relativedelta(days=0, months=6, years=1) that determines how long a repository has to be inactive before it gets archived.

Adding a repository to the allow list

The archive_repository.py module contains a list of repositories for the MoJ GH Org and AS GH Org that this process will ignore.

Un-archiving a repository

If a user requests that a repository be un-archived they will either need to update the main branch on that repository before this script executes the next day, or add the repository name to the allow list, which will give the user time to update the repository in their own time.

This page was last reviewed on 8 April 2024. It needs to be reviewed again on 8 July 2024 by the page owner #operations-engineering-alerts .
This page was set to be reviewed before 8 July 2024 by the page owner #operations-engineering-alerts. This might mean the content is out of date.