From 39fe6999f2bf15196f6bd00c078c72d2e196cfd9 Mon Sep 17 00:00:00 2001 From: Andreas Heinrich Date: Mon, 8 Jul 2024 14:50:41 +0200 Subject: [PATCH] reorder Signed-off-by: Andreas Heinrich --- .../workflows/deploy-single-docker-image.yml | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deploy-single-docker-image.yml b/.github/workflows/deploy-single-docker-image.yml index ccfe35d..2878937 100644 --- a/.github/workflows/deploy-single-docker-image.yml +++ b/.github/workflows/deploy-single-docker-image.yml @@ -71,7 +71,29 @@ jobs: ref: ${{ inputs.github_ref_after }} token: ${{secrets.SA_GITHUB_PAT}} fetch-depth: 0 + - name: Validate github_ref_before and github_ref_after + id: validate-inputs + run: | + echo "Check validity of github_ref_before.." + if git cat-file -e ${{ inputs.github_ref_before }}^{commit}; then + "github_ref_before='${{ inputs.github_ref_before }}' is a commit!✅" + else + echo "github_ref_before='${{ inputs.github_ref_before }}' is not a commit!❌ -> Rebuild image!" + echo "validation_failed=true" >> $GITHUB_OUTPUT + exit 0 + fi + echo "Check validity of github_ref_after.." + if git cat-file -e ${{ inputs.github_ref_after }}^{commit}; then + "github_ref_after='${{ inputs.github_ref_after }}' is a commit!✅" + else + echo "github_ref_after='${{ inputs.github_ref_after }}' is not a commit!❌ -> Rebuild image!" + echo "validation_failed=true" >> $GITHUB_OUTPUT + exit 0 + fi + echo "validation_failed=false" >> $GITHUB_OUTPUT + working-directory: source - name: Parse depends_on_paths + if: steps.validate-inputs.outputs.validation_failed == 'false' id: setup-regex shell: python3 {0} working-directory: source @@ -94,27 +116,6 @@ jobs: # set the regex as an output with open(os.environ["GITHUB_OUTPUT"], "a") as f: f.write(f"regex={regex}\n") - - name: Validate github_ref_before and github_ref_after - id: validate-inputs - run: | - echo "Check validity of github_ref_before.." - if git cat-file -e $sha^{commit}; then - "github_ref_before='${{ inputs.github_ref_before }}' is a commit!✅" - else - echo "github_ref_before='${{ inputs.github_ref_before }}' is not a commit!❌ -> Rebuild image!" - echo "validation_failed=true" >> $GITHUB_OUTPUT - exit 0 - fi - echo "Check validity of github_ref_after.." - if git cat-file -e $sha^{commit}; then - "github_ref_after='${{ inputs.github_ref_after }}' is a commit!✅" - else - echo "github_ref_after='${{ inputs.github_ref_after }}' is not a commit!❌ -> Rebuild image!" - echo "validation_failed=true" >> $GITHUB_OUTPUT - exit 0 - fi - echo "validation_failed=false" >> $GITHUB_OUTPUT - working-directory: source - name: Get changed files if: steps.validate-inputs.outputs.validation_failed == 'false' id: check