From b6999ce061b975f1c6c99c790782323b91c5eb21 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Sat, 5 Feb 2022 15:27:51 +0200 Subject: [PATCH] ci: Moving GH Action template syntax to env variables --- .github/actions/deploy-dir-as-branch/action.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/actions/deploy-dir-as-branch/action.yml b/.github/actions/deploy-dir-as-branch/action.yml index 0910ca753a..d37086a4e9 100644 --- a/.github/actions/deploy-dir-as-branch/action.yml +++ b/.github/actions/deploy-dir-as-branch/action.yml @@ -11,8 +11,10 @@ runs: - name: Creating temporary directory to clone the branch shell: bash run: | - BRANCH_DIR=$(mktemp -d "`pwd`/cloned_${{ inputs.target_branch }}_XXXXXX") + BRANCH_DIR=$(mktemp -d "`pwd`/$BRANCH_DIR_TEMPLATE") echo "BRANCH_DIR=$BRANCH_DIR" >> $GITHUB_ENV + env: + BRANCH_DIR_TEMPLATE: 'cloned_${{ inputs.target_branch }}_XXXXXX' - name: Checkout `${{ inputs.target_branch }}` branch uses: actions/checkout@v2 @@ -31,7 +33,7 @@ runs: echo '::endgroup::' echo '::group::Move necessary files' - cp -vnR '${{ github.workspace }}/${{ inputs.src_dir }}/.' . + cp -vnR "$SRC_DIR/." . echo '::endgroup::' git add -A @@ -41,12 +43,16 @@ runs: git config user.name 'GitHub Action Script' git config user.email 'please@open.issue' - git commit -a -m 'Deploy ${{ github.sha }} to '${{ inputs.target_branch }}' branch' + git commit -a -m "Deploy $SHA to '$TARGET_BRANCH' branch" git push echo 'Pushed' fi + env: + SRC_DIR: '${{ github.workspace }}/${{ inputs.src_dir }}' + SHA: ${{ github.sha }} + TARGET_BRANCH: ${{ inputs.target_branch }} - name: Remove cloned branch if: ${{ always() }} shell: bash - run: 'rm -rf $BRANCH_DIR' + run: 'rm -rf "$BRANCH_DIR"'