Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action doesn't work #27

Open
ccfontes opened this issue Apr 15, 2024 · 2 comments
Open

action doesn't work #27

ccfontes opened this issue Apr 15, 2024 · 2 comments
Assignees

Comments

@ccfontes
Copy link

ccfontes commented Apr 15, 2024

Context: it's a private repo

workflow:

name: diktat
on: push
jobs:
  diktat_check:
    name: 'diKTat Check'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: saveourtool/benedikt@v2
        with:
            input-paths: |
              src/**/*.kt

Error log:

/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-[37](https://github.com/user_redacted/project_redacted/actions/runs/8688208424/job/23823324987#step:3:39)6b8159896f.sh: line 1: ((: == 0 : syntax error: operand expected (error token is "== 0 ")
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-376b8159896f.sh: line 14: ((: != 0 : syntax error: operand expected (error token is "!= 0 ")
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-376b8159896f.sh: line 21: ((: <= 1 : syntax error: operand expected (error token is "<= 1 ")
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-376b8159896f.sh: line 26: ((: != 1 : syntax error: operand expected (error token is "!= 1 ")

Action log:

Run if [[ 'false' == 'true' ]]
  if [[ 'false' == 'true' ]]
  then
    set -x
  fi
  DIKTAT_ARGS=('--config' 'diktat-analysis.yml' '--reporter' 'sarif')
  if [[ 'sarif' == 'sarif' ]]
  then
    report_file=${GITHUB_WORKSPACE}/report.sarif
  elif [[ 'sarif' == 'checkstyle' ]]
  then
    report_file=${GITHUB_WORKSPACE}/checkstyle-report.xml
  else
    echo "<reporter> should be set to <sarif> or <checkstyle>"
    exit 1
  fi
  DIKTAT_ARGS+=('--output' "${report_file}")
  
  if [[ 'false' == 'true' ]]
  then
    DIKTAT_ARGS+=('--log-level' 'DEBUG')
  fi
  
  set -o pipefail
  IFS=$'\n'
  INPUT_PATHS=(src/**/*.kt
  )
  DIKTAT_CMD=${GITHUB_WORKSPACE}/diktat
  chmod +x ${DIKTAT_CMD}
  { ${DIKTAT_CMD} "${DIKTAT_ARGS[@]}" "${INPUT_PATHS[@]}" | tee diktat.log; } && exit_code=$? || exit_code=$?
  total_lines=$(wc -l diktat.log | cut -d ' ' -f1)
  summary_line_number=$(grep -n 'Summary error count (descending) by rule:' diktat.log | cut -d: -f1)
  summary_line=$(tail -n $((total_lines - summary_line_number)) diktat.log | sed -e 's/^  //g' | awk '{ printf("%s,", $0) }' | sed -e 's/,$//g')
  echo "summary-line=${summary_line}" >>$GITHUB_OUTPUT
  rm -f diktat.log
  echo "exit-code=${exit_code}" >>$GITHUB_OUTPUT
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    GITHUB_TOKEN: ***
Error: Process completed with exit code 1.
Run if ((  == 0 ))
  if ((  == 0 ))
  then
    status_icon=':heavy_check_mark:'
    message='completed successfully'
  else
    status_icon=':x:'
    message='exited with code ****'
  fi
  
  diktat='[_diKTat_](https://github.com/saveourtool/diktat)'
  
  echo "${status_icon} ${diktat} ${message}" >>${GITHUB_STEP_SUMMARY}
  
  if ((  != 0 ))
  then
    echo '```console' >>${GITHUB_STEP_SUMMARY}
    echo "" | xargs -d ',' -n1 echo >>${GITHUB_STEP_SUMMARY}
    echo '```' >>${GITHUB_STEP_SUMMARY}
  fi
  
  if ((  <= 1 ))
  then
    ${GITHUB_WORKSPACE}/diktat --version | awk '{ split($0, versions, ": *"); print " - _" versions[1] "_: **" versions[2] "**" }' >>${GITHUB_STEP_SUMMARY}
  fi
  
  if ((  != 1 ))
  then
    exit 
  elif [[ 'true' != 'false' ]]
  then
    exit 1
  fi
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-[37](https://github.com/user_redacted/project_redacted/actions/runs/8688208424/job/23823324987#step:3:39)6b8159896f.sh: line 1: ((: == 0 : syntax error: operand expected (error token is "== 0 ")
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-376b8159896f.sh: line 14: ((: != 0 : syntax error: operand expected (error token is "!= 0 ")
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-376b8159896f.sh: line 21: ((: <= 1 : syntax error: operand expected (error token is "<= 1 ")
/home/runner/work/_temp/da04cdc5-94bd-4ef0-8ec0-376b8159896f.sh: line 26: ((: != 1 : syntax error: operand expected (error token is "!= 1 ")
@unix-junkie
Copy link

@ccfontes, thank you for the report!

The problem might have been caused by the version upgrade of Diktat.

I'll look into the problem and get back to you.
Meanwhile, could you please try version 1.2.5 of the action and check whether it works for you?

@ccfontes
Copy link
Author

@unix-junkie downgrade fixed the issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants