-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 2.2 KB
/
sync-data.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# see https://docs.github.com/en/actions
name: 'Sync data from yuque.com'
# Use repository_dispatch event to manually trigger github actions
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
# Triggers the workflow on repository_dispatch request events
# https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
repository_dispatch:
# parameter `event_type` field
types: [sync-with-yuque]
# Triggers the workflow on push or pull request events but only for the main branch
# push:
# branches: [ main ]
# pull_request:
# branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "dispatch"
dispatch:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/[email protected]
with:
# Set always-auth in npmrc
always-auth: false # optional, default is false
# Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
node-version: 16.x
# Retrieve event payload
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#tojson
- name: Retrieve the `client_payload` value from repository_dispatch event
run: |
echo "Event payload: ${{ toJson(github.event.client_payload) }}"
- name: Generate local file
uses: ./
with:
# token field is optional
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
out-dir: 'docs'
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#tojson
client-payload: ${{toJson(github.event.client_payload)}}