From 5004d0d99f036cee1602d1a3a260b755066f9892 Mon Sep 17 00:00:00 2001 From: Daniel Brunner Date: Sat, 18 Sep 2021 22:36:19 +0200 Subject: [PATCH] Add action.yml --- action.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..4aa131f --- /dev/null +++ b/action.yml @@ -0,0 +1,24 @@ +name: Get submodule hash +description: Tries to acquire the hash of a submodule +inputs: + submodule: + description: Path to submodule (relative from repo root) + required: true +outputs: + hash: + description: The hash of the submodule + value: ${{ steps.get-submodule-hash.outputs.hash }} +runs: + using: composite + steps: + - id: get-submodule-hash + run: | + SUBMODULE_HASH="$(git submodule | awk '{ if ($2 == "${{ inputs.submodule }}") print $1 }')" + if [[ -z "${SUBMODULE_HASH}" ]] + then + echo ERROR: could not get hash for submodule ${{ inputs.submodule }} + git submodule + exit 1 + fi + echo "::set-output name=hash::${SUBMODULE_HASH#"-"}" + shell: bash