-
-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (64 loc) · 2.02 KB
/
generate-readme.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Generate README
concurrency:
group: generate-readme-${{ github.event.number }}
cancel-in-progress: true
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "31 1,12 * * *"
push:
branches:
- main
jobs:
generate-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Setup Deno
uses: denolib/setup-deno@v2
with:
deno-version: v1.30
- name: Download indexes
run: |
URLS=(
https://raw.githubusercontent.com/nanlabs/frontend-reference/main/examples.json
https://raw.githubusercontent.com/nanlabs/devops-reference/main/examples.json
https://raw.githubusercontent.com/nanlabs/backend-reference/main/examples.json
)
# Download files preventing duplicated names (e.g. examples.json)
i=0
for url in "${URLS[@]}"; do
filename=$(basename "$url")
extension="${filename##*.}"
filename="${filename%.*}"
filename="$filename-$i.$extension"
curl -s "$url" -o "$filename"
i=$((i + 1))
done
- name: Generate README
run: |
# Get the list of examples previously downloaded
EXAMPLES=$(ls examples-*.json)
# Generate the README
./tools/readme-generator/main.ts README.md.tmpl examples.json $EXAMPLES
# Remove the downloaded files
rm examples-*.json
- name: Run prettier
run: npx prettier --write README.md
- name: Run markdownlint
uses: articulate/actions-markdownlint@v1
with:
fix: true
files: README.md
- name: Run Awesome Lint
run: npx awesome-lint
- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
message: "Update README"