GithubHelp home page GithubHelp logo

bitranox / keep_github_workflows_active Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 77 KB

keep github workflows active

License: MIT License

Makefile 2.65% Python 57.67% Jupyter Notebook 2.96% Shell 34.83% Batchfile 1.90%

keep_github_workflows_active's Introduction

keep_github_workflows_active

Version v1.1.0 as of 2024-03-01 see Changelog

build_badge codeql license jupyter pypi PyPI - Downloads black codecov Maintainability Maintainability Code Coverage snyk

GitHub Workflow Management Script

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:

  1. Keep All Workflows Active: Ensures that all workflows in each repository of the user remain in an active state.
  2. Delete Old Workflow Runs: For each repository, this function retains a specified number of the most recent workflow runs and deletes all older runs.

Access Key

In order to access the repository workflows, you will need a fine-grained personal test token. Follow the link to generate the token:

Permissions

Ensure the access key has the following permissions:

  • Action: Read/Write
  • Metadata: Read

Test Token Details

The current test token is valid until 2025-01-19 and needs to be renewed annually.

Token Storage for testing

The token is stored as a secret in the repository's "repository secrets." Navigate to the following link to manage repository secrets:

Secrets Information

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 <https://github .com/bitranox/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

You might try it right away in Jupyter Notebook by using the "launch binder" badge, or click here <https://mybinder.org/v2/gh/{{rst_include. repository_slug}}/master?filepath=keep_github_workflows_active.ipynb>

Usage

  • 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 from Commandline

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

Installation and Upgrade

  • 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

Requirements

following modules will be automatically installed :

## Project Requirements
click
cli_exit_tools
lib_detect_testenv
lib_log_utils
toml
requests

Acknowledgements

  • special thanks to "uncle bob" Robert C. Martin, especially for his books on "clean code" and "clean architecture"

Contribute

I would love for you to fork and send me pull request for this project. - please Contribute

License

This software is licensed under the MIT license

---

Changelog

  • 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

v1.1.0

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

v1.0.0

2024-01-20: initial release

keep_github_workflows_active's People

Contributors

bitranox avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.