Metadata-Version: 2.1
Name: githubot
Version: 0.7.0
Summary: Command line tool to use Github API to automate some works.
Home-page: https://github.com/WqyJh/githubot
Author: wqy
Author-email: qiyingwangwqy@gmail.com
License: UNKNOWN
Keywords: github,ci
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3 :: Only
Description-Content-Type: text/markdown
Requires-Dist: pygithub
Requires-Dist: docopt

# githubot

[![Build Status](https://travis-ci.org/WqyJh/githubot.svg?branch=master)](https://travis-ci.org/WqyJh/githubot)
[![license](https://img.shields.io/badge/LICENCE-MIT-brightgreen.svg)](https://raw.githubusercontent.com/WqyJh/githubot/master/LICENSE)


Command line tool to use Github's API for automation:

- [x] create release with assets
- [x] upload/download files to github
- [ ] TODO

## Installation

```bash
pip install githubot
```

## Usage

### Create release with assets

```bash
Releases management.

Usage: githubot release --token=TOKEN --repo=REPO
                        [--tag=TAG] [--title=TITLE] [--message=MESSAGE]
                        [ASSETS...]

Options:
    --token=TOKEN           Github access token.
    -r=REPO --repo=REPO     Repo full name like: owner/repo.
    --tag=TAG               Tag name for the release. If the tag does not
                            exist it will be created on default branch.
    --title=TITLE           Title for the release.
    --message=MESSAGE       Message for the release.
    -h --help               Show this message and exit.
```

For example:

Create a release to repo `WqyJh/test` with assets under the path of `assets/`.

```bash
githubot release --token <github_token> --repo WqyJh/test assets/*
```

Create a release and specify `tag`, `title` and `message` for it.

```bash
githubot release \
--token <github_token> \
--repo WqyJh/test \
--tag test_tag \
--title "This is an test title" \
--message "This release contains xxx" \
assets/*
```

Only regular files are supported for the `--assets` option, directories are not supported.
You can specify files in the following manner:

```bash
--assets file1 file2
--assets path/* # wildcard
```

### Use github repo as cloud storage

```bash
Files management.

Usage: githubot file upload --token=TOKEN --repo=REPO  [FILES...]
       githubot file download --token=TOKEN --repo=REPO  [FILES...]

Options:
    --token=TOKEN           Github access token.
    -r=REPO --repo=REPO     Repo full name like: owner/repo.
    -h --help               Show this message and exit.
```

#### Upload files

Upload files to github repo `WqyJh/test`.

```bash
./run.py file upload \
--token <github_token> \
--repo WqyJh/test \
file1 file2 file*
```

**Note** that the `FILES` argument is just the same with `ASSETS`, only regular files are supported.


#### Download files

Download files from github repo `WqyJh/test`.

```bash
./run.py file download \
--token <github_token> \
--repo WqyJh/test \
file1 dir1 dir2/
```

**Note** that the `FILES` argument here cannot contains wildcard, but it can contains directories.


#### Delete files

Delete files from github repo.

```bash
./run.py file delete \
--token <github_token> \
--repo Wqyjh/test \
file1 dir1 dir2/
```


## Development

- bumping 0.3.0 (PYPI)
- auto-changelog 1.15.0 (NPM)

The release processing is as follow:

1. Calculate semantic version
    ```bash
    git checkout dev
    git pull origin dev
    bumping
    ```
2. Create release branch from dev
    ```bash
    git checkout -b release-<version>
    ```
3. Modify the version and commit
4. Generate changelog and commit
    ```bash
    auto-changelog --latest-version <version> --tag-prefix v
    ```
5. Merge to master branch
6. Tag version to master branch

### Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [0.7.0](https://github.com/WqyJh/githubot/compare/v0.6.1...0.7.0)

> 12 July 2020

- feat: add config command [`#16`](https://github.com/WqyJh/githubot/pull/16)

#### [v0.6.1](https://github.com/WqyJh/githubot/compare/v0.6.0...v0.6.1)

> 21 August 2019

- Fix cli [`#11`](https://github.com/WqyJh/githubot/pull/11)
- docs: update CHANGELOG.md [`f557e71`](https://github.com/WqyJh/githubot/commit/f557e71c4ca511ced33c818d77276a0dc1c850fe)
- fix: fix cli [`c66043a`](https://github.com/WqyJh/githubot/commit/c66043aa0450b7a62e9e4a82086cefd3058412c6)
- Bump version to 0.6.1 [`bfa3d06`](https://github.com/WqyJh/githubot/commit/bfa3d062db77fe30574fa6bd20151c12157c6488)

#### [v0.6.0](https://github.com/WqyJh/githubot/compare/v0.4.0...v0.6.0)

> 21 August 2019

- Release 0.6.0 [`#10`](https://github.com/WqyJh/githubot/pull/10)
- docs: update README.md [`#9`](https://github.com/WqyJh/githubot/pull/9)
- feat: add file delete [`#8`](https://github.com/WqyJh/githubot/pull/8)
- feat: add directory downloading [`#7`](https://github.com/WqyJh/githubot/pull/7)
- docs: update README.md [`#4`](https://github.com/WqyJh/githubot/pull/4)
- docs: update CHANGELOG.md [`e6c15a5`](https://github.com/WqyJh/githubot/commit/e6c15a5a9b10526f5ee9dcd643fd09db2f9b94b5)
- Bump version to 0.6.0 [`7156b94`](https://github.com/WqyJh/githubot/commit/7156b94f214c33791f42480e431178ca7a09a162)
- Resolve conflicts [`c794221`](https://github.com/WqyJh/githubot/commit/c794221bd74c70a7beff5b430b1c4f45680f2d07)

#### v0.4.0

> 20 August 2019

- Release 0.4.0 [`#2`](https://github.com/WqyJh/githubot/pull/2)
- Storage [`#1`](https://github.com/WqyJh/githubot/pull/1)
- feat: add release creation with assets uploading [`28c5214`](https://github.com/WqyJh/githubot/commit/28c52147fc591bebb6bdf4d9da1599605a0cd876)
- feat: replace click with docopt [`9a7acd9`](https://github.com/WqyJh/githubot/commit/9a7acd98baaab0afd8a321886c7305be5943c6ef)
- chore: add setup configurations [`2cc899f`](https://github.com/WqyJh/githubot/commit/2cc899fd1d1159a56188fde21d3d8f08042bb604)


