-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (87 loc) · 2.47 KB
/
Copy pathsync.yaml
File metadata and controls
95 lines (87 loc) · 2.47 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Sync to Public Repo
on:
workflow_call:
inputs:
private_repo:
required: true
type: string
description: Private repository URL
public_repo:
required: true
type: string
description: Public repository URL
keep:
required: false
type: string
default: src
description: Space-separated paths to keep
keep_from_file:
required: false
type: string
default: ""
description: File containing paths to keep
sync_branch:
required: false
type: string
default: upstream/sync
description: Sync branch name
main_branch:
required: false
type: string
default: main
description: Main branch name
private_branch:
required: false
type: string
default: main
description: Private branch to sync from
merge:
required: false
type: boolean
default: false
description: Merge into main after sync
force:
required: false
type: boolean
default: false
description: Force push
dry_run:
required: false
type: boolean
default: false
description: Dry run mode
secrets:
GH_TOKEN:
required: true
description: GitHub token with push access to public repo
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Install git-sync-filtered
run: pip install git-sync-filtered
- name: Sync filtered repo
run: |
ARGS=(
--private "${{ inputs.private_repo }}"
--public "${{ inputs.public_repo }}"
--sync-branch "${{ inputs.sync_branch }}"
--main-branch "${{ inputs.main_branch }}"
--private-branch "${{ inputs.private_branch }}"
)
if [ -n "${{ inputs.keep_from_file }}" ]; then
ARGS+=(--keep-from-file "${{ inputs.keep_from_file }}")
fi
if [ -n "${{ inputs.keep }}" ]; then
for path in ${{ inputs.keep }}; do
ARGS+=(--keep "$path")
done
fi
[ "${{ inputs.merge }}" = "true" ] && ARGS+=(--merge)
[ "${{ inputs.force }}" = "true" ] && ARGS+=(--force)
[ "${{ inputs.dry_run }}" = "true" ] && ARGS+=(--dry-run)
git-sync-filtered "${ARGS[@]}"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}