https://github.com/lbwa/yuque-sync
Sync post data from yuque.com. Serverless function only work with @tencentyun
https://github.com/lbwa/yuque-sync
serverless webhook yuque
Last synced: about 1 year ago
JSON representation
Sync post data from yuque.com. Serverless function only work with @tencentyun
- Host: GitHub
- URL: https://github.com/lbwa/yuque-sync
- Owner: lbwa
- License: mit
- Created: 2021-05-09T14:32:26.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-05T15:12:10.000Z (almost 5 years ago)
- Last Synced: 2025-03-08T08:46:56.692Z (over 1 year ago)
- Topics: serverless, webhook, yuque
- Language: Go
- Homepage:
- Size: 615 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# YuQue Sync
[](https://github.com/marketplace/actions/yuque-sync)
Use [Repository Dispatch Event](https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event) to manually trigger Github Action.
## Github Action
```yml
- name: Generate local file
uses: lbwa/yuque-sync@v2.0.3
with:
token: ${{ secrets.ACCESS_TOKEN }}
out-dir: 'docs'
client-payload: ${{toJson(github.event.client_payload)}}
```
| name | description | default |
| :------------: | :-----------------------------------------------------: | :------: |
| token | A repo scoped Github Personal Access Token | N/A |
| out-dir | Where should our documentations be place in | `'docs'` |
| client-payload | A request payload from Github Repository Dispatch Event | N/A |
## Serverless function
- clear building
```bash
go clean
```
- build
```bash
GOOS=linux GOARCH=amd64 go build -o main main.go
```
- use `ctrl+shift+b` to run vscode [build task](./.vscode/tasks.json)
## Notice
`YuQue repository -> settings -> advanced settings(in the SideBar) -> advanced settings(in the main content) -> enable automatic publish` item should **be disabled**, otherwise, YuQue webhook would never be triggered.
More details in [YuQue Webhook](https://www.yuque.com/yuque/developer/doc-webhook).
## FAQ
- Q: github rest api response 404?
- A: Please make sure [Personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) has **ALL ACCESSES** in `repo` scope, especially for private repo.
## References
- [create a repository dispatch event](https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event)
- [event that trigger workflow](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch)