Skip to content

Commit 81e019a

Browse files
ci: adds composite action calling docs sync workflow
1 parent d07fadf commit 81e019a

1 file changed

Lines changed: 12 additions & 43 deletions

File tree

.github/workflows/sync-docs.yml

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ on:
55
branches:
66
- main
77
paths:
8-
- "docs/**"
8+
- "docs/**"
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- "docs/**"
914
workflow_dispatch:
1015

1116
jobs:
12-
config-sync:
13-
name: Sync docs to docs site repo
17+
sync-docs:
1418
runs-on: ubuntu-latest
15-
1619
steps:
20+
1721
- name: Generate a GitHub token
1822
id: ghtoken
1923
uses: actions/create-github-app-token@v1
@@ -22,48 +26,13 @@ jobs:
2226
owner: slackapi
2327
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
2428

25-
- name: Checkout the tool repo (source)
26-
uses: actions/checkout@v4
27-
28-
- name: Checkout the docs site repo (destination)
29+
- name: Checkout private actions repo
2930
uses: actions/checkout@v4
3031
with:
3132
repository: slackapi/slackapi.github.io
32-
path: "docs_repo"
3333
token: ${{ steps.ghtoken.outputs.token }}
3434
persist-credentials: false
35+
path: docs_repo
3536

36-
- name: Update docs in docs site repo
37-
run: |
38-
rsync -av --delete ./docs/ ./docs_repo/content/${{ github.event.repository.name }}/
39-
40-
- name: Install dependencies
41-
run: |
42-
cd docs_repo
43-
npm ci
44-
45-
- name: Build Docusaurus site
46-
run: |
47-
cd docs_repo
48-
npm run build
49-
50-
- name: Create a pull request
51-
if: ${{ github.event.pull_request.merged || github.event_name == 'workflow_dispatch' }}
52-
id: site-pr
53-
uses: peter-evans/create-pull-request@v7
54-
with:
55-
token: ${{ steps.ghtoken.outputs.token }}
56-
title: "From ${{ github.event.repository.name }}: ${{ github.event.pull_request.title || 'manual docs sync' }}"
57-
body: "${{ github.event.pull_request.body }}"
58-
author: "slackapi[bot] <186980925+slackapi[bot]@users.noreply.github.com>"
59-
committer: "slackapi[bot] <186980925+slackapi[bot]@users.noreply.github.com>"
60-
commit-message: "Sync docs from ${{ github.event.repository.name }} to docs site repo"
61-
base: "main"
62-
branch: "docs-sync-${{ github.event.repository.name }}-${{ github.sha }}"
63-
labels: docs
64-
path: "./docs_repo"
65-
66-
- name: Output the pull request link
67-
if: ${{ steps.site-pr.outputs.pull-request-url }}
68-
run: |
69-
echo "Pull request created: ${{ steps.site-pr.outputs.pull-request-url }}" >> $GITHUB_STEP_SUMMARY
37+
- name: Run sync-docs action
38+
uses: ./docs_repo/.github/actions/sync-from-tools-docs

0 commit comments

Comments
 (0)