watching 0.0.4

Creator: bradpython12

Last updated:

0 purchases

watching 0.0.4 Image
watching 0.0.4 Images

Languages

Categories

Add to Cart

Description:

watching 0.0.4

# Repo WatchingGithub repos watching framework## Install```shellpip install watching```## Simple Usagefunction `ctx.upsert_file_and_pr` is a helper to update or create file and create pull request .```pythonwatcher = Watcher({ 'github_access_token': ACCESS_TOKEN,})def license_middleware(ctx: Context): branch = 'watcher_license_create' path = '/LICENSE' new_content = 'MIT\n\ncreated by joway' message = 'add MIT license' pr_title = 'Init: MIT License' pr_body = '- create MIT License' file_branch = 'master' ctx.upsert_file_and_pr( path=path, content=new_content, branch=branch, should_upsert=lambda new, old: new != old, message=message, pr_title=pr_title, pr_body=pr_body, )def other_middleware(ctx: Context): passdef filter_func(repo: Repo): if repo.name == 'repo-watching-demo': return True# task chain , it will be executed by every repowatcher.use(license_middleware, other_middleware)# filter the repos you needrepos = watcher.get_all_repos(filter_func=filter_func)# listen reposwatcher.listen(repos)# traverse all repos you listenedwatcher.run()```## Advanced Usage```python# get commit listctx.repo.commit_list()# access your github username | org namectx.repo.loginctx.repo.name# create filectx.repo.file_create()# update filectx.repo.file_update()# get filectx.repo.file_get()# create branchctx.repo.branch_create()# create prctx.repo.pr_create()```

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.