Version v1.1.0 as of 2024-03-01 see Changelog
This manual guides you through the execution of a Python script designed to manage GitHub workflows across all repositories of a user. The script performs two main functions:
- Keep All Workflows Active: Ensures that all workflows in each repository of the user remain in an active state.
- Delete Old Workflow Runs: For each repository, this function retains a specified number of the most recent workflow runs and deletes all older runs.
In order to access the repository workflows, you will need a fine-grained personal test token. Follow the link to generate the token:
- [Generate Fine-Grained Personal Test Token](https://github.com/settings/personal-access-tokens)
Ensure the access key has the following permissions:
- Action: Read/Write
- Metadata: Read
The current test token is valid until 2025-01-19 and needs to be renewed annually.
The token is stored as a secret in the repository's "repository secrets." Navigate to the following link to manage repository secrets:
- [Repository Secrets](https://github.com/bitranox/keep_github_workflows_active/settings/secrets/actions)
The following secrets need to be set:
- SECRET_GITHUB_OWNER: the GitHub username
- SECRET_GITHUB_TOKEN: The fine-grained access key
automated tests, Github Actions, Documentation, Badges, etc. are managed with PizzaCutter (cookiecutter on steroids)
Python version required: 3.8.0 or newer
tested on recent linux with python 3.12 - architectures: amd64
100% code coverage, flake8 style checking ,mypy static type checking ,tested under Linux, automatic daily builds and monitoring
- Try it Online
- Usage
- Usage from Commandline
- Installation and Upgrade
- Requirements
- Acknowledgements
- Contribute
- Report Issues
- Pull Request
- Code of Conduct
- License
- Changelog
You might try it right away in Jupyter Notebook by using the "launch binder" badge, or click here
- example for including docstrings
def main() -> None:
"""
enable all workflows in all repositories for the given owner
>>> # we actually don't do that here AGAIN because of GitHub Rate limits
>>> # those functions are called anyway already by doctest
>>> # main()
"""
Usage: keep_github_workflows_active [OPTIONS] COMMAND [ARGS]... keep gitgub workflows active Options: --version Show the version and exit. --traceback / --no-traceback return traceback information on cli -h, --help Show this message and exit. Commands: info get program informations
- Before You start, its highly recommended to update pip:
python -m pip --upgrade pip
- to install the latest release from PyPi via pip (recommended):
python -m pip install --upgrade keep_github_workflows_active
- to install the latest release from PyPi via pip, including test dependencies:
python -m pip install --upgrade keep_github_workflows_active[test]
- to install the latest version from github via pip:
python -m pip install --upgrade git+https://github.com/bitranox/keep_github_workflows_active.git
- include it into Your requirements.txt:
# Insert following line in Your requirements.txt: # for the latest Release on pypi: keep_github_workflows_active # for the latest development version : keep_github_workflows_active @ git+https://github.com/bitranox/keep_github_workflows_active.git # to install and upgrade all modules mentioned in requirements.txt: python -m pip install --upgrade -r /<path>/requirements.txt
- to install the latest development version, including test dependencies from source code:
# cd ~ $ git clone https://github.com/bitranox/keep_github_workflows_active.git $ cd keep_github_workflows_active python -m pip install -e .[test]
- via makefile: makefiles are a very convenient way to install. Here we can do much more, like installing virtual environments, clean caches and so on.
# from Your shell's homedirectory:
$ git clone https://github.com/bitranox/keep_github_workflows_active.git
$ cd keep_github_workflows_active
# to run the tests:
$ make test
# to install the package
$ make install
# to clean the package
$ make clean
# uninstall the package
$ make uninstall
following modules will be automatically installed :
## Project Requirements
click
cli_exit_tools
lib_detect_testenv
lib_log_utils
toml
requests
- special thanks to "uncle bob" Robert C. Martin, especially for his books on "clean code" and "clean architecture"
I would love for you to fork and send me pull request for this project. - please Contribute
This software is licensed under the MIT license
---
- new MAJOR version for incompatible API changes,
- new MINOR version for added functionality in a backwards compatible manner
- new PATCH version for backwards compatible bug fixes
- 2024-02-29:
- disable windows and osx tests to avoid hitting API limits
- omit mypy option --no-implicit-reexport
- github actions/checkout@v4
- github actions/setup-python@v5
- use requests instead of urllib
- delete old Workflow runs
2024-01-20: initial release