Skip to content

Commit 58e50f2

Browse files
committed
fix: devdocs sync once in a week through a PR
1 parent f775003 commit 58e50f2

File tree

1 file changed

+43
-76
lines changed

1 file changed

+43
-76
lines changed

.github/workflows/devdocs-sync.yml

Lines changed: 43 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,108 +3,75 @@ name: Dev Docs Sync
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: "0 6 * * 0" # Outline PR weekly (Sundays 06:00 UTC)
7-
- cron: "0 5 * * *" # Repos READMEs daily 05:00 UTC
8-
- cron: "0 4 * * 0" # Auto API docs weekly 04:00 UTC
6+
- cron: "0 6 * * 0" # run weekly, Sundays 06:00 UTC
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: dev-docs-sync-${{ github.ref }}
14+
cancel-in-progress: true
915

1016
jobs:
11-
outline_to_pr:
12-
if: github.event_name == 'workflow_dispatch' || contains(join(fromJson('["0 6 * * 0"]'), ','), '') # always true for schedule
17+
weekly_sync_all_to_one_pr:
1318
runs-on: ubuntu-latest
1419
steps:
15-
- uses: actions/checkout@v4
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install pandoc
26+
run: sudo apt-get update && sudo apt-get install -y pandoc
1627

1728
- name: Use Node
1829
uses: actions/setup-node@v4
19-
with: { node-version: 18 }
30+
with:
31+
node-version: 18
32+
cache: npm
2033

2134
- name: Install deps
2235
run: npm ci
2336

37+
# 1) Outline -> docs/dev
2438
- name: Sync Outline → docs/dev
2539
env:
2640
OUTLINE_URL: ${{ secrets.OUTLINE_URL }}
2741
OUTLINE_TOKEN: ${{ secrets.OUTLINE_TOKEN }}
28-
29-
# Defaults for collection names (override via repo Variables if you want)
3042
OUTLINE_COLLECTION_CONTRIBUTING: ${{ vars.OUTLINE_COLLECTION_CONTRIBUTING != '' && vars.OUTLINE_COLLECTION_CONTRIBUTING || 'Contributing' }}
3143
OUTLINE_COLLECTION_SPECS: ${{ vars.OUTLINE_COLLECTION_SPECS != '' && vars.OUTLINE_COLLECTION_SPECS || 'Specs' }}
32-
OUTLINE_COLLECTION_DEVGUIDE: ${{ vars.OUTLINE_COLLECTION_DEVGUIDE != '' && vars.OUTLINE_COLLECTION_DEVGUIDE || 'Developer guide' }}
44+
OUTLINE_COLLECTION_DEVGUIDE: ${{ vars.OUTLINE_COLLECTION_DEVGUIDE != '' && vars.OUTLINE_COLLECTION_ROADMAP || 'Developer guide' }}
3345
OUTLINE_COLLECTION_SETUPGUIDE: ${{ vars.OUTLINE_COLLECTION_SETUPGUIDE != '' && vars.OUTLINE_COLLECTION_SETUPGUIDE || 'Setup Guide' }}
3446
OUTLINE_THROTTLE_MS: ${{ vars.OUTLINE_THROTTLE_MS != '' && vars.OUTLINE_THROTTLE_MS || '800' }}
3547
OUTLINE_MAX_RETRIES: ${{ vars.OUTLINE_MAX_RETRIES != '' && vars.OUTLINE_MAX_RETRIES || '6' }}
3648
run: npm run devdocs:sync:outline
3749

38-
39-
- name: Create PR if changes
40-
uses: peter-evans/create-pull-request@v6
41-
with:
42-
commit-message: "docs(dev): sync from Outline"
43-
branch: chore/devdocs-outline-sync
44-
title: "DevDocs: Sync from Outline"
45-
body: "Automated one-way sync from Outline collections."
46-
labels: docs, automation
47-
signoff: true
48-
49-
repos_daily_merge:
50-
runs-on: ubuntu-latest
51-
steps:
52-
- uses: actions/checkout@v4
53-
with:
54-
submodules: recursive # pull submodules
55-
56-
- name: Install pandoc
57-
run: sudo apt-get update && sudo apt-get install -y pandoc
58-
59-
- name: Use Node
60-
uses: actions/setup-node@v4
61-
with: { node-version: 18 }
62-
63-
- name: Install deps
64-
run: npm ci
65-
50+
# 2) Integration repo READMEs (multi-version + submodules)
6651
- name: Sync integration READMEs
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for API auth + higher rate limits
54+
INTEGRATION_TAGS: all # all | latest | CSV
55+
MAX_TAGS: '20'
6756
run: npm run devdocs:sync:repos
6857

69-
- name: Commit directly if changed (auto-merge intent)
70-
run: |
71-
set -e
72-
if [[ -n "$(git status --porcelain)" ]]; then
73-
git config user.name "github-actions[bot]"
74-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
75-
git add -A
76-
git commit -m "docs(dev): sync integration READMEs (auto)"
77-
git push
78-
else
79-
echo "No changes."
80-
fi
81-
82-
auto_api_docs:
83-
runs-on: ubuntu-latest
84-
steps:
85-
- uses: actions/checkout@v4
86-
87-
- name: Use Node
88-
uses: actions/setup-node@v4
89-
with: { node-version: 18 }
90-
91-
- name: Install deps
92-
run: npm ci
93-
58+
# 3) Auto API docs
9459
- name: Build Auto API docs (Rasenmäher)
9560
env:
96-
RASENMAEHER_OPENAPI_URL: ${{ vars.RASENMAEHER_OPENAPI_URL != '' && vars.RASENMAEHER_OPENAPI_URL || 'https://pvarki.github.io/docker-rasenmaeher-integration/openapi.json' }}
61+
RASENMAEHER_OPENAPI_URL: ${{ vars.RASENMAEHER_OPENAPI_URL != '' && vars.RASENMAEHER_OPENAPI_URL || 'https://pvarki.github.io/docker-rasenmaeher-integration/openapi.json' }}
9762
run: npm run devdocs:build:autoapi
9863

99-
- name: Commit if changed
100-
run: |
101-
set -e
102-
if [[ -n "$(git status --porcelain)" ]]; then
103-
git config user.name "github-actions[bot]"
104-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
105-
git add -A
106-
git commit -m "docs(dev): update auto API docs"
107-
git push
108-
else
109-
echo "No changes."
110-
fi
64+
# Single PR for above
65+
- name: Create/Update PR with all changes
66+
uses: peter-evans/create-pull-request@v6
67+
with:
68+
commit-message: "docs(dev): weekly dev-docs sync (Outline + repos + API)"
69+
branch: chore/devdocs-weekly-sync
70+
title: "DevDocs: Weekly Sync (Outline + Repos + API)"
71+
body: |
72+
Automated weekly sync combining:
73+
- Outline → docs/dev
74+
- Integration repo READMEs (multi-version + submodules)
75+
- Auto-generated API docs
76+
labels: docs, automation
77+
signoff: true

0 commit comments

Comments
 (0)