-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (66 loc) · 2.01 KB
/
Copy pathsync.yml
File metadata and controls
80 lines (66 loc) · 2.01 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
78
79
80
name: Sync
on:
push:
workflow_dispatch:
workflow_call:
# Cancel in-progress runs when starting a new one.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Build the list of target repositories from the config.
init:
runs-on: ubuntu-latest
outputs:
children: ${{ steps.parse.outputs.children }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Checkout github-graph
uses: actions/checkout@v4
with:
repository: SgtSwagrid/github-graph
path: .github-graph
- name: Parse config
id: parse
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: bash .github-graph/scripts/parse-config.sh
# Synchronise each target repository.
sync:
name: sync → ${{ matrix.child.target.name }}
needs: init
if: needs.init.outputs.children != '[]'
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
child: ${{ fromJson(needs.init.outputs.children) }}
steps:
- name: Checkout github-graph
uses: actions/checkout@v4
with:
repository: SgtSwagrid/github-graph
path: .github-graph
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ matrix.child.source.branch }}
path: source
- name: Checkout target
uses: actions/checkout@v4
with:
repository: ${{ matrix.child.target.repository }}
ref: ${{ matrix.child.target.branch }}
token: ${{ secrets[matrix.child.token] }}
path: target
- name: Load config
run: bash .github-graph/scripts/load-config.sh '${{ toJson(matrix.child) }}'
- name: Merge files
run: bash .github-graph/scripts/merge-files.sh
- name: Commit changes
env:
GH_TOKEN: ${{ secrets[matrix.child.token] }}
run: bash .github-graph/scripts/publish.sh