"#"
This commit is contained in:
@@ -22,4 +22,4 @@ Initial release. Extracted from [private-monorepo-example](https://code.itkan.io
|
||||
|
||||
- Python + pyyaml replaced by yq-go (single static binary)
|
||||
- 7 separate scripts replaced by single `josh-sync` CLI
|
||||
- Consumer workflows use composite action (`uses: org/josh-sync@v1`)
|
||||
- Consumer workflows use composite action (`uses: https://your-gitea/org/josh-sync@v1`)
|
||||
|
||||
@@ -35,7 +35,7 @@ Copy from [examples/](examples/) and customize paths/branches:
|
||||
|
||||
```yaml
|
||||
# .gitea/workflows/josh-sync-forward.yml
|
||||
- uses: org/josh-sync@v1
|
||||
- uses: https://your-gitea.example.com/org/josh-sync@v1
|
||||
with:
|
||||
direction: forward
|
||||
env:
|
||||
@@ -59,7 +59,7 @@ Run `josh-sync preflight` to validate your setup.
|
||||
## CLI
|
||||
|
||||
```
|
||||
josh-sync sync [--forward|--reverse] [--target NAME] [--branch BRANCH]
|
||||
josh-sync sync [--forward|--reverse] [--target NAME[,NAME]] [--branch BRANCH]
|
||||
josh-sync preflight
|
||||
josh-sync import <target>
|
||||
josh-sync reset <target>
|
||||
|
||||
12
action.yml
12
action.yml
@@ -56,9 +56,9 @@ runs:
|
||||
env:
|
||||
JOSH_SYNC_DEBUG: ${{ inputs.debug == 'true' && '1' || '0' }}
|
||||
run: |
|
||||
ARGS="--config ${{ inputs.config }}"
|
||||
[[ "${{ inputs.direction }}" == "forward" ]] && ARGS+=" --forward"
|
||||
[[ "${{ inputs.direction }}" == "reverse" ]] && ARGS+=" --reverse"
|
||||
[[ -n "${{ inputs.target }}" ]] && ARGS+=" --target ${{ inputs.target }}"
|
||||
[[ -n "${{ inputs.branch }}" ]] && ARGS+=" --branch ${{ inputs.branch }}"
|
||||
josh-sync sync $ARGS
|
||||
ARGS=(--config "${{ inputs.config }}")
|
||||
[[ "${{ inputs.direction }}" == "forward" ]] && ARGS+=(--forward)
|
||||
[[ "${{ inputs.direction }}" == "reverse" ]] && ARGS+=(--reverse)
|
||||
[[ -n "${{ inputs.target }}" ]] && ARGS+=(--target "${{ inputs.target }}")
|
||||
[[ -n "${{ inputs.branch }}" ]] && ARGS+=(--branch "${{ inputs.branch }}")
|
||||
josh-sync sync "${ARGS[@]}"
|
||||
|
||||
@@ -81,7 +81,7 @@ Global flags:
|
||||
Sync flags:
|
||||
--forward Forward only (mono → subrepo)
|
||||
--reverse Reverse only (subrepo → mono)
|
||||
--target NAME Filter to one target (env: JOSH_SYNC_TARGET)
|
||||
--target NAME Filter to target(s) — comma-separated for multiple (env: JOSH_SYNC_TARGET)
|
||||
--branch BRANCH Filter to one branch
|
||||
|
||||
Environment:
|
||||
@@ -137,7 +137,7 @@ _sync_direction() {
|
||||
target_name=$(echo "$TARGET_JSON" | jq -r '.name')
|
||||
|
||||
# Filter to specific target if requested
|
||||
if [ -n "$filter_target" ] && [ "$filter_target" != "$target_name" ]; then
|
||||
if [ -n "$filter_target" ] && ! echo ",$filter_target," | grep -q ",${target_name},"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Customize:
|
||||
# - paths: list all target subfolders
|
||||
# - branches: list all monorepo branches to trigger on
|
||||
# - org/josh-sync@v1: pin to your library repo and version
|
||||
# - uses: https://your-gitea.example.com/org/josh-sync@v1 — pin to your library repo and version
|
||||
|
||||
name: "Josh Sync → Subrepo"
|
||||
|
||||
@@ -59,10 +59,10 @@ jobs:
|
||||
| jq -r '.[] | "\(.name):\(.subfolder)"' \
|
||||
| while IFS=: read -r name prefix; do
|
||||
echo "$CHANGED" | grep -q "^${prefix}/" && echo "$name"
|
||||
done | sort -u | tr '\n' ' ')
|
||||
done | sort -u | paste -sd ',' -)
|
||||
echo "targets=${TARGETS}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: org/josh-sync@v1
|
||||
- uses: https://your-gitea.example.com/org/josh-sync@v1
|
||||
with:
|
||||
direction: forward
|
||||
target: ${{ github.event.inputs.target || steps.detect.outputs.targets }}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Customize:
|
||||
# - cron schedule
|
||||
# - org/josh-sync@v1: pin to your library repo and version
|
||||
# - uses: https://your-gitea.example.com/org/josh-sync@v1 — pin to your library repo and version
|
||||
|
||||
name: "Josh Sync ← Subrepo"
|
||||
|
||||
@@ -40,7 +40,7 @@ jobs:
|
||||
curl -sL "https://github.com/mikefarah/yq/releases/download/v4.44.6/yq_linux_amd64" \
|
||||
-o /usr/local/bin/yq && chmod +x /usr/local/bin/yq
|
||||
|
||||
- uses: org/josh-sync@v1
|
||||
- uses: https://your-gitea.example.com/org/josh-sync@v1
|
||||
with:
|
||||
direction: reverse
|
||||
target: ${{ github.event.inputs.target || '' }}
|
||||
|
||||
Reference in New Issue
Block a user