From 618327a8f9da03225a03e78b53e0b69b119d2de1 Mon Sep 17 00:00:00 2001 From: Daniel Brunner Date: Tue, 4 Jan 2022 14:07:43 +0100 Subject: [PATCH] Testings with repo parameter --- action.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index ca35a4f..4dffe3c 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,9 @@ inputs: submodule: description: Path to submodule (relative from repo root) required: true + repo: + description: Path to the repo + required: false outputs: {} runs: using: composite @@ -13,14 +16,15 @@ runs: uses: 0xFEEDC0DE64/get_submodule_hash@main with: submodule: ${{ inputs.submodule }} + repo: ${{ inputs.repo }} - name: Cache submodule ${{ inputs.submodule }} id: cache-submodule uses: actions/cache@v2 with: path: | - .git/modules/${{ inputs.submodule }} - ${{ inputs.submodule }} + ./${{ inputs.repo }}/.git/modules/${{ inputs.submodule }} + ./${{ inputs.repo }}/${{ inputs.submodule }} key: ${{ runner.os }}-${{ steps.get-submodule-hash.outputs.hash }} - name: Checkout submodule ${{ inputs.submodule }} @@ -32,6 +36,12 @@ runs: then echo "Cache hit - skipping submodule update" else - git submodule update --init --recursive ${{ inputs.submodule }} + REPO_ARGS= + if [[ ! -z "${{ inputs.repo }}" ]] + then + REPO_ARGS=(-C "${{ inputs.repo }}") + fi + + git "${REPO_ARGS[@]}" submodule update --init --recursive ${{ inputs.submodule }} fi shell: bash