-
Notifications
You must be signed in to change notification settings - Fork 0
Archive Tool Improvements #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
440f662
Add markdown support for exemption file
TotalDwarf03 d1cc944
Add manual archive instructions to archive notification
TotalDwarf03 5188f50
Add support for config file in S3.
TotalDwarf03 8602528
add debug.log to make clean
TotalDwarf03 4550117
increase log retention + log names of repositories acted on
TotalDwarf03 e45b50a
update unit tests
TotalDwarf03 4ca8116
Start mkdocs implementation
TotalDwarf03 77388e8
docs 90% done. TODO: process.md + linting
TotalDwarf03 a930ad3
fix broken test due to archive notification change
TotalDwarf03 96a2ab6
md linting
TotalDwarf03 e9149be
finish docs
TotalDwarf03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # A GitHub Actions workflow to deploy MkDocs documentation to GitHub Pages on push to the master or main branch. | ||
| --- | ||
| name: Deploy MkDocs | ||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - main | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Configure Git Credentials | ||
| run: | | ||
| git config user.name github-actions[bot] | ||
| git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.x | ||
| - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| key: mkdocs-material-${{ env.cache_id }} | ||
| path: .cache | ||
| restore-keys: | | ||
| mkdocs-material- | ||
| - run: pip install mkdocs-material | ||
| - run: pip install poetry | ||
| - run: poetry install --only docs | ||
| - run: mkdocs gh-deploy --force | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| { | ||
| "features": { | ||
| "show_log_locally": true | ||
| "show_log_locally": false, | ||
| "use_local_config": false | ||
| }, | ||
| "archive_configuration": { | ||
| "archive_threshold": 365, | ||
| "notification_period": 30, | ||
| "notification_issue_tag": "Archive Notice", | ||
| "exemption_filename": "ArchiveExemption.txt", | ||
| "exemption_filename": ["ArchiveExemption.txt", "ArchiveExemption.md"], | ||
| "maximum_notifications": 1 | ||
| } | ||
| } |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Documentation | ||
|
|
||
| This site uses MkDocs to build its documentation and GitHub Pages for hosting. | ||
|
|
||
| ## Format | ||
|
|
||
| Documentation within this project follows the following pattern: | ||
|
|
||
| - A `README.md` for each component | ||
| - A `/docs` folder for the project | ||
|
|
||
| Each `README.md` should contain: | ||
|
|
||
| - A description of what the component is/does | ||
| - A list of any prerequisites | ||
| - Setup instructions | ||
| - Execution instructions | ||
| - Deployment instructions | ||
|
|
||
| The `/docs` folder should contain: | ||
|
|
||
| - A description of what the project is | ||
| - An overview of how the everything fits together in the project | ||
| - An explanation of the tech stack | ||
| - Details of the underlying dataset | ||
|
|
||
| A majority of the information should reside within the `/docs` directory over the `README`. The `README`s in this project should be kept for concise instructions on how to use each component. Any detailed explanation should be kept within `/docs`. | ||
|
|
||
| ## Getting MkDocs Setup | ||
|
|
||
| In order to build an MkDocs deployment or serve the documentation locally, we need to install MkDocs and its dependencies. | ||
|
|
||
| 1. Navigate into the project's root directory. | ||
|
|
||
| 2. Install MkDocs and its dependencies. | ||
|
|
||
| ```bash | ||
| make install-docs | ||
| ``` | ||
|
|
||
| 3. You can now use MkDocs. To see a list of commands run the following: | ||
|
|
||
| ```bash | ||
| mkdocs --help | ||
| ``` | ||
|
|
||
| ## Updating MkDocs Deployment | ||
|
|
||
| ### GitHub Action to Deploy Documentation | ||
|
|
||
| A GitHub Action is set up to automatically deploy the documentation to GitHub Pages whenever a commit is made to the `main` branch. This action is triggered by a push event to the `main` branch and runs the `mkdocs gh-deploy` command to build and deploy the documentation. | ||
|
|
||
| ### Manual Deployment | ||
|
|
||
| If changes are made within `/docs`, the GitHub Pages deployment will need to be updated. Assuming you have already installed [MkDocs](https://www.mkdocs.org/getting-started/#installation) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/getting-started/#installation), do the following: | ||
|
|
||
| 1. Navigate to the projects root directory. | ||
|
|
||
| 2. Deploy the documentation to GitHub Pages. | ||
|
|
||
| ```bash | ||
| mkdocs gh-deploy | ||
| ``` | ||
|
|
||
| 3. This will build the documentation and deploy it to the `gh-pages` branch of your repository. The documentation will be available at `https://ONS-Innovation.github.io/<repository-name>/`. | ||
|
|
||
| **Please Note:** The `gh-deploy` command will overwrite the `gh-pages` branch and make the local changes available on GitHub Pages. Make sure that these changes are appropriate and have been reviewed before deployment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Frequently Asked Questions (FAQs) | ||
|
|
||
| ## How does the Archive Process Work? | ||
|
|
||
| - Each week, the archive tool will process each non-archived repository within ONSdigital. | ||
| - For each repository, it will: | ||
| - Check if the repository hasn't been updated within the last year. | ||
| - If it hasn't been updated, it will create an issue in the repository to notify the maintainers. The issue will include details about how to avoid the repository being archived and how to archive the repository manually. | ||
| - If an issue already exists for the repository, it will check how long ago the issue was created. | ||
| - If the issue was created more than 30 days ago, the tool will archive the repository. | ||
|
|
||
| In depth information on this process is available within the [Technical Documentation](./technical_documentation/the_process.md). | ||
|
|
||
| ## How Can I Prevent My Repository from Being Archived? | ||
|
|
||
| To prevent your repository from being archived, you should push an update to the repository at least once a year. We recommend that an `ArchiveExemption.txt` or `ArchiveExemption.md` file is added to the root of the repository to indicate that it should not be archived. This file should contain a brief explanation of why the repository is still relevant and should not be archived. | ||
|
|
||
| This file will need to be updated annually to ensure that the repository remains exempt from archiving. If you do not update this file, the repository will be archived after a year of inactivity. | ||
|
|
||
| ## What Happens if My Repository is Archived? | ||
|
|
||
| When a repository is archived, it becomes read-only. This means that no further changes can be made to the repository, including issues or pull requests. The repository can still be viewed for reference, including any open issues or pull requests that were present at the time of archiving. If you need to make changes to an archived repository, you will need to unarchive it first. | ||
|
|
||
| ## How Do I Unarchive a Repository? | ||
|
|
||
| In order to unarchive a repository, you need to have administrative access to the repository either being an organisation or repository owner. You can unarchive a repository by going to the repository settings and selecting the "Unarchive" option. | ||
|
|
||
| To avoid the repository from being archived again, ensure that you push an update to the repository. This will make it exempt from archiving for another year. You may also want to add an `ArchiveExemption.txt` or `ArchiveExemption.md` file to the root of the repository to indicate that it should not be archived in the future. | ||
|
|
||
| It is important to note that if a repository is without an owner or has no active admin users, an organisation admin will need to unarchive the repository. | ||
|
|
||
| All repositories within ONSdigital should be maintained to have an up-to-date `CODEOWNERS` file and repository admins to ensure that access is available for unarchiving when necessary. This is specified within ONS' GitHub Usage Policy and must be adhered to. | ||
|
|
||
| ## Can I Archive My Own Repository? | ||
|
|
||
| We encourage repository owners to archive their own repositories if they are no longer actively maintained or relevant. You can do this by going to the repository settings and selecting the "Archive" option. We recommend that you also add a notice to the repository's README file to inform users that the repository is archived and no longer maintained, along with closing any open issues or pull requests. This helps us align with GitHub's recommended practices for archiving repositories. | ||
|
|
||
| ## Further Questions | ||
|
|
||
| For any further questions or concerns regarding the archiving process, please create an issue in the [Archive Tool repository](https://github.com/ONS-Innovation/github-repository-archive-script/issues) or contact an ONSdigital Owner. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # GitHub Repository Archive Script | ||
|
|
||
| ## Overview | ||
|
|
||
| The Repository Archive Script is a Python script designed to automatically archive GitHub repositories that haven't been updated for a specified period of time. Archiving older repositories helps keep ONSdigital's GitHub organisation clean and organised, making it easier for users to find active projects, and reducing the organisation's footprint and maintenance overhead. | ||
|
|
||
| ## Frequently Asked Questions (FAQs) | ||
|
|
||
| If you have any questions about the Repository Archive Script and its functionality, please refer to the [FAQs](./faq.md) section for more information. | ||
|
|
||
| If this does not answer your question, please feel free to open an issue in the GitHub repository with the question label or contact an organisation owner. | ||
|
|
||
| ## Technical Documentation | ||
|
|
||
| For information about the technical aspects of the Repository Archive Script, including its design, configuration, and logging, please refer to the [Technical Documentation](./technical_documentation/overview.md). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you install poetry directly instead of Pip aswell