From f2785241bfc95a04120d130aa3251a12e42c7a90 Mon Sep 17 00:00:00 2001 From: Slim B Date: Thu, 12 Feb 2026 11:22:51 +0300 Subject: [PATCH] "#" --- CHANGELOG.md | 2 +- README.md | 4 ++-- action.yml | 12 ++++++------ bin/josh-sync | 4 ++-- examples/forward.yml | 6 +++--- examples/reverse.yml | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f53e45c..8af14fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`) diff --git a/README.md b/README.md index 94e16f9..c3ad370 100644 --- a/README.md +++ b/README.md @@ -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 josh-sync reset diff --git a/action.yml b/action.yml index 5faf00f..629cf21 100644 --- a/action.yml +++ b/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[@]}" diff --git a/bin/josh-sync b/bin/josh-sync index 38f8a63..610460c 100755 --- a/bin/josh-sync +++ b/bin/josh-sync @@ -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 diff --git a/examples/forward.yml b/examples/forward.yml index 5c2fad7..97d499f 100644 --- a/examples/forward.yml +++ b/examples/forward.yml @@ -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 }} diff --git a/examples/reverse.yml b/examples/reverse.yml index e532b01..def838a 100644 --- a/examples/reverse.yml +++ b/examples/reverse.yml @@ -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 || '' }}