From 0b265937ebe0c9d4bdb7941476f2fd309b7c7893 Mon Sep 17 00:00:00 2001 From: Eduardo Robles Elvira Date: Fri, 15 Jul 2022 11:54:46 +0100 Subject: [PATCH] fixing sign-commits boolean variable conditionals --- action.yml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/action.yml b/action.yml index 925beb1..16c0504 100644 --- a/action.yml +++ b/action.yml @@ -52,7 +52,7 @@ inputs: sign-commits: description: 'Set to true if the action should sign the commit with GPG' required: false - default: '' + default: 'false' gpg-private-key: description: 'GPG Private Key with which to sign the commits in the PR to be created' required: false @@ -69,7 +69,7 @@ runs: using: "composite" steps: - name: Import bot's GPG key for signing commits - if: ${{ inputs.sign-commits }} + if: ${{ inputs.sign-commits == 'true' }} id: import-gpg uses: crazy-max/ghaction-import-gpg@v4 with: @@ -79,10 +79,9 @@ runs: git_user_signingkey: true git_commit_gpgsign: true - name: Set environment variables (signed commits) - if: ${{ inputs.sign-commits }} + if: ${{ inputs.sign-commits == 'true' }} shell: bash env: - SIGN_COMMITS: ${{ inputs.sign-commits }} GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }} GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }} @@ -93,21 +92,9 @@ runs: echo "GIT_AUTHOR_EMAIL=$GIT_AUTHOR_EMAIL" >> $GITHUB_ENV echo "GIT_COMMITTER_NAME=$GIT_COMMITTER_NAME" >> $GITHUB_ENV echo "GIT_COMMITTER_EMAIL=$GIT_COMMITTER_EMAIL" >> $GITHUB_ENV - echo "TARGETS=$TARGETS" >> $GITHUB_ENV - GIT_COMMIT_MESSAGE="$(git log --format=%b -n 1)" - GIT_COMMIT_MESSAGE="${GIT_COMMIT_MESSAGE//'%'/'%25'}" - GIT_COMMIT_MESSAGE="${GIT_COMMIT_MESSAGE//$'\n'/'%0A'}" - GIT_COMMIT_MESSAGE="${GIT_COMMIT_MESSAGE//$'\r'/'%0D'}" - echo "GIT_COMMIT_MESSAGE=$GIT_COMMIT_MESSAGE" >> $GITHUB_ENV - - name: Set environment variables - if: ${{ !inputs.sign-commits }} + - name: Set environment variables (unsigned commits) + if: ${{ inputs.sign-commits != 'true' }} shell: bash - env: - SIGN_COMMITS: ${{ inputs.sign-commits }} - GIT_AUTHOR_NAME: ${{ steps.import-gpg.outputs.name }} - GIT_AUTHOR_EMAIL: ${{ steps.import-gpg.outputs.email }} - GIT_COMMITTER_NAME: ${{ steps.import-gpg.outputs.name }} - GIT_COMMITTER_EMAIL: ${{ steps.import-gpg.outputs.email }} run: | echo "GIT_AUTHOR_NAME=github-actions[bot]" >> $GITHUB_ENV echo "GIT_AUTHOR_EMAIL=" >> $GITHUB_ENV