diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 9e3a385..334bfa8 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -30,17 +30,17 @@ jobs: - name: Check if feature branch for ${{ inputs.liquibase-version }} exists id: branch_check run: | - BRANCH_EXISTS=$(git ls-remote --heads origin feature/protobuf-${{ inputs.liquibase-version }} | wc -l) - echo "::set-output name=branch_exists::$BRANCH_EXISTS" + BRANCH_EXISTS=$(git ls-remote --exit-code --heads origin ${{ inputs.liquibase-version }} &>/dev/null && echo "true" || echo "false") + echo "BRANCH_EXISTS=$BRANCH_EXISTS" >> $GITHUB_ENV - - name: Create or checkout branch for ${{ inputs.liquibase-version }} + - name: Create or checkout branch run: | - if [ ${{ steps.branch_check.outputs.branch_exists }} -eq 0 ]; then - git checkout -b feature/protobuf-${{ inputs.liquibase-version }} - git push origin feature/protobuf-${{ inputs.liquibase-version }} + if [ "${{ env.BRANCH_EXISTS }}" = "false" ]; then + git checkout -b ${{ inputs.liquibase-version }} + git push origin ${{ inputs.liquibase-version }} else - git checkout feature/protobuf-${{ inputs.liquibase-version }} - git pull origin feature/protobuf-${{ inputs.liquibase-version }} + git checkout ${{ inputs.liquibase-version }} + git pull origin ${{ inputs.liquibase-version }} fi - name: Create feature branch