diff --git a/action.yaml b/action.yaml index 6655f7c..cf0a338 100644 --- a/action.yaml +++ b/action.yaml @@ -19,31 +19,37 @@ inputs: description: 'Password used for the connection to the image registry' required: false default: ${{ secrets.PMO_REGISTRY_PASSWORD }} + debug: + description: 'Run the action in debug mode' + required: false + default: false + type: boolean runs: using: 'composite' steps: + - name: Set debug mode + if: ${{ inputs.debug == true }} + shell: bash + run: | + source "${{ github.action_path }}/bashlib.sh" + export DEBUG="ON" + echo "DEBUG=ON" >> $GITEA_ENV + debug Debug switch on + - name: Podman connection to the registry shell: bash run: | - GREEN='\033[0;32m' - RED='\033[0;31m' - NC='\033[0m' # No Color + source "${{ github.action_path }}/bashlib.sh" + + check_command ${{ inputs.registry_command }} + + step "${{ inputs.registry_command }} connection to registry" "${{ inputs.registry_server }}..." - if [[ -z $(which ${{ inputs.registry_command }}) ]] ; then - echo -e "${RED}❌ Error:${NC}: Cannot locate the ${{ inputs.registry_command }} command" - exit 1 - fi - - echo -e "${YELLOW}🔄 ${{ inputs.registry_command }} connection to registry:${NC} ${{ inputs.registry_server }}..." + result=$(${{ inputs.registry_command }} login ${{ inputs.registry_server }} \ + -u ${{ inputs.registry_user }} \ + -p ${{ inputs.registry_password }}) \ + && success "${result}" \ + || error "Error" "${result}" - result=$(${{ inputs.registry_command }} login ${{ inputs.registry_server }} \ - -u ${{ inputs.registry_user }} \ - -p ${{ inputs.registry_password }}) \ - && echo -e "${GREEN}✅ $result${NC}" \ - || echo -e "${RED}❌ Error: ${NC} $result" - - - -