Skip to content

Commit 0eb29d7

Browse files
ci: Moving GH Action template syntax to env variables (#3484)
1 parent 07864ab commit 0eb29d7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/actions/deploy-dir-as-branch/action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ runs:
1111
- name: Creating temporary directory to clone the branch
1212
shell: bash
1313
run: |
14-
BRANCH_DIR=$(mktemp -d "`pwd`/cloned_${{ inputs.target_branch }}_XXXXXX")
14+
BRANCH_DIR=$(mktemp -d "`pwd`/$BRANCH_DIR_TEMPLATE")
1515
echo "BRANCH_DIR=$BRANCH_DIR" >> $GITHUB_ENV
16+
env:
17+
BRANCH_DIR_TEMPLATE: 'cloned_${{ inputs.target_branch }}_XXXXXX'
1618

1719
- name: Checkout `${{ inputs.target_branch }}` branch
1820
uses: actions/checkout@v2
@@ -31,7 +33,7 @@ runs:
3133
echo '::endgroup::'
3234
3335
echo '::group::Move necessary files'
34-
cp -vnR '${{ github.workspace }}/${{ inputs.src_dir }}/.' .
36+
cp -vnR "$SRC_DIR/." .
3537
echo '::endgroup::'
3638
3739
git add -A
@@ -41,12 +43,16 @@ runs:
4143
git config user.name 'GitHub Action Script'
4244
git config user.email '[email protected]'
4345
44-
git commit -a -m 'Deploy ${{ github.sha }} to '${{ inputs.target_branch }}' branch'
46+
git commit -a -m "Deploy $SHA to '$TARGET_BRANCH' branch"
4547
git push
4648
echo 'Pushed'
4749
fi
50+
env:
51+
SRC_DIR: '${{ github.workspace }}/${{ inputs.src_dir }}'
52+
SHA: ${{ github.sha }}
53+
TARGET_BRANCH: ${{ inputs.target_branch }}
4854

4955
- name: Remove cloned branch
5056
if: ${{ always() }}
5157
shell: bash
52-
run: 'rm -rf $BRANCH_DIR'
58+
run: 'rm -rf "$BRANCH_DIR"'

0 commit comments

Comments
 (0)