-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (68 loc) · 1.94 KB
/
Copy pathsync-docs.yml
File metadata and controls
77 lines (68 loc) · 1.94 KB
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
name: Sync Docs
on:
push:
branches:
- main
paths:
- .github/workflows/sync-docs.yml
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
discover:
name: Discover Repos
runs-on: ubuntu-latest
outputs:
repos: ${{ steps.find.outputs.repos }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Find repos
id: find
run: |
set -euo pipefail
ORG="${GITHUB_REPOSITORY_OWNER,,}"
repos=$(
gh api --paginate "/orgs/${ORG}/repos" \
--jq '[.[] | select(
.archived == false and
.disabled == false and
(.name | ascii_downcase | IN("bluelua.github.io", ".github") | not)
) | .name]'
)
echo "repos=${repos}" >> "${GITHUB_OUTPUT}"
sync:
name: Sync ${{ matrix.repo }}
needs: discover
if: ${{ needs.discover.outputs.repos != '[]' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
strategy:
matrix:
repo: ${{ fromJson(needs.discover.outputs.repos) }}
fail-fast: false
steps:
- name: Checkout central docs repo
uses: actions/checkout@v6
- name: Checkout ${{ matrix.repo }} docs
uses: actions/checkout@v6
with:
repository: ${{ github.repository_owner }}/${{ matrix.repo }}
sparse-checkout: docs
path: _src
- name: Copy docs
run: |
target="docs/src/${{ matrix.repo }}"
rm -rf "${target}"
[ -d "_src/docs" ] || exit 0
mkdir -p "${target}"
cp -R _src/docs/. "${target}"
- name: Open docs PR
uses: peter-evans/create-pull-request@v8
with:
commit-message: "docs: sync ${{ matrix.repo }}"
title: "docs: sync ${{ matrix.repo }}"
branch: docs/${{ matrix.repo }}
add-paths: docs/src/${{ matrix.repo }}