codimd-git-sync/README.md

48 lines
1.3 KiB
Markdown
Raw Normal View History

A python webserver that automatically hooks into a mattermost instance, listens for any mentions of codiMD files, downloads them locally and then commits them to a git repo based on a specific metadata block in the codimd file.
2022-04-18 23:14:37 +02:00
**TODO**
- Hook into mattermost to automatically react to new files
- Change gitlab integration to gitea
**Done**
- Webserver that starts a sync when an endpoint is called
- Automatic detection of codimd file links in mattermost message
- Download of codimd files
- Creation of a gitlab pull request for any new files
- Creation of new commits for any new changes to the files. Hereby updating the existing pull request or creating a new one.
## How to run (currently)
# Start local webserver
make webserver
# Curl the webserver to trigger the sync
make sync
## CodiMD
2022-04-18 23:14:37 +02:00
You need to put the following block somewhere in you CodiMD file.
```markdown
2022-04-18 23:14:59 +02:00
:::spoiler Gitlab sync
2022-04-18 23:14:37 +02:00
- sync-to: path/in/the/drive
:::
```
## Setup
2024-03-27 17:19:45 +01:00
Copy the `config.example.toml` file to `config.toml` and complete the missing values.
2022-04-18 23:19:21 +02:00
## Used tech
- [GitLab CLI Tool](https://glab.readthedocs.io/en/latest/index.html)
- bash
- git
- curl
- python
2022-04-18 23:19:21 +02:00
### References
- [CodiMD source code](https://github.com/hackmdio/codimd/tree/develop/lib). Usefull to find the api endpoints.