# Repo Watching
Github repos watching framework
## Install
```shell
pip install watching
```
## Simple Usage
function `ctx.upsert_file_and_pr` is a helper to update or create file and create pull request .
```python
watcher = 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):
pass
def filter_func(repo: Repo):
if repo.name == 'repo-watching-demo':
return True
# task chain , it will be executed by every repo
watcher.use(license_middleware, other_middleware)
# filter the repos you need
repos = watcher.get_all_repos(filter_func=filter_func)
# listen repos
watcher.listen(repos)
# traverse all repos you listened
watcher.run()
```
## Advanced Usage
```python
# get commit list
ctx.repo.commit_list()
# access your github username | org name
ctx.repo.login
ctx.repo.name
# create file
ctx.repo.file_create()
# update file
ctx.repo.file_update()
# get file
ctx.repo.file_get()
# create branch
ctx.repo.branch_create()
# create pr
ctx.repo.pr_create()
```
Metadata
Release files for watching 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| watching-0.0.4.tar.gz | 3.8 kB | Without provenance | Details for watching-0.0.4.tar.gz |
Release files / watching-0.0.4.tar.gz
| Download URL | watching-0.0.4.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
448e401911838b424b5218bd699bf593c3e5e6ce884380786640c922f2416374
|
|
BLAKE2b-256 checksum How to use checksums |
1e7ae3c6fe45a92ac11fac41d76967f9cf350322aa55092a531e46cdc1677d25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/2.7
|
Security for watching 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.