[fix] Step condition variable was improperly defined

This commit is contained in:
Lucas PASCAL
2022-03-14 14:54:17 +01:00
parent e0002739f0
commit 55b6f9bc99
2 changed files with 13 additions and 4 deletions

View File

@@ -44,25 +44,34 @@ runs:
ORIGIN="$(pwd)" ORIGIN="$(pwd)"
cd ${{ inputs.directory }} cd ${{ inputs.directory }}
git switch ${{ inputs.branch }} 2>/dev/null || git switch -c ${{ inputs.branch }} git switch ${{ inputs.branch }} 2>/dev/null || git switch -c ${{ inputs.branch }}
echo "-----------------------------------------------------------"
echo "Initial repo status"
git status git status
CHANGES="$(git status --porcelain ${{ inputs.files }})" CHANGES="$(git status --porcelain ${{ inputs.files }})"
if [ -z "${CHANGES}" ]; \ if [ -z "${CHANGES}" ]; \
then \ then \
echo "-----------------------------------------------------------"; \
echo "No changes, stopping now"; \ echo "No changes, stopping now"; \
echo "::save-state name=COMMIT::NO"; \ echo "COMMIT=NO" > $GITHUB_ENV; \
cd "${ORIGIN}"; \ cd "${ORIGIN}"; \
exit 0; \ exit 0; \
fi fi
echo -e "Changes:\n${CHANGES}" echo -e "Changes:\n${CHANGES}"
git add ${{ inputs.files }} git add ${{ inputs.files }}
echo "-----------------------------------------------------------"
echo "Repo status before commit"
git status
git commit -am "${{ inputs.message }}" git commit -am "${{ inputs.message }}"
echo "::save-state name=COMMIT::YES" echo "COMMIT=YES" > $GITHUB_ENV
git log -n 2 git log -n 2
cd "${ORIGIN}" cd "${ORIGIN}"
shell: bash shell: bash
- run: echo "${{ env.COMMIT }}"
shell: bash
- name: Push commit - name: Push commit
if: ${{ steps.commit.state.COMMIT == 'YES' }} if: ${{ env.COMMIT == 'YES' }}
uses: ad-m/github-push-action@master uses: ad-m/github-push-action@master
with: with:
github_token: ${{ inputs.secret }} github_token: ${{ inputs.secret }}

View File

@@ -50,4 +50,4 @@ jobs:
branch: ${{ steps.extract_branch.outputs.branch }} branch: ${{ steps.extract_branch.outputs.branch }}
message: "[update][SDK] Branch ${{ steps.extract_branch.outputs.branch }} | Commit ${GITHUB_SHA}" message: "[update][SDK] Branch ${{ steps.extract_branch.outputs.branch }} | Commit ${GITHUB_SHA}"
secret: ${{ secrets.CI_BOT_TOKEN }} secret: ${{ secrets.CI_BOT_TOKEN }}
repository: LedgerHQ/ethereum-plugin-sdk repository: LedgerHQ/app-ethereum