diff --git a/.github/workflows/shellcheck.yaml b/.github/workflows/shellcheck.yaml deleted file mode 100644 index 26c09ef..0000000 --- a/.github/workflows/shellcheck.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# This is a basic workflow to help you get started with Actions -name: Shell Check - -# Controls when the workflow will run -on: - workflow_call: - pull_request: - paths-ignore: - - '**/Chart.yaml' - - '**/README.md' - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -env: - VERSION: "0.9.0" - BASH_SCRIPT: "shellcheck.sh" - BASH_SCRIPT_INSTALL: "shellcheck-install.sh" - BASH_SCRIPT_RESULT: 0 - MESSAGE_HEADER: "Shell Check" - MESSAGE: "" - -permissions: - pull-requests: write - contents: write - packages: read - actions: write - checks: write - statuses: write - -jobs: - shellcheck: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - name: Setup - id: "setup" - shell: bash - env: - VERSION: ${{ env.VERSION }} - run: | - ${GITHUB_WORKSPACE}/scripts/ci/${{ env.BASH_SCRIPT_INSTALL }} - - name: Shell Check - id: "shell-check" - shell: bash - env: - VERSION: ${{ env.VERSION }} - run: | - set +e - ${GITHUB_WORKSPACE}/scripts/ci/${{ env.BASH_SCRIPT }} &> bash_output.txt - echo "BASH_SCRIPT_RESULT=$?" >> "$GITHUB_ENV" - - # https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings - echo 'MESSAGE<> $GITHUB_ENV - cat "${GITHUB_WORKSPACE}/pr-status-check-human-friendly.txt" >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - - echo "::group:: Bash Script Output" - cat bash_output.txt - echo "::endgroup::" - - if: env.BASH_SCRIPT_RESULT == 0 - name: "Remove Sticky Pull Request Comment" - uses: marocchino/sticky-pull-request-comment@v2.9.1 - with: - header: ":star2: :collision: :collision: [${{ env.MESSAGE_HEADER }}] :collision: :collision: :collision:" - delete: true - - if: env.BASH_SCRIPT_RESULT != 0 - name: "Workflow Commands" - shell: bash - run: | - if [ -f "${GITHUB_WORKSPACE}/github-workflow-commands.txt" ]; then - cat "${GITHUB_WORKSPACE}/github-workflow-commands.txt" - fi - - if: env.BASH_SCRIPT_RESULT != 0 - name: "Add Sticky Pull Request Comment" - uses: marocchino/sticky-pull-request-comment@v2.9.1 - with: - recreate: true - header: ":star2: :collision: :collision: [${{ env.MESSAGE_HEADER }}] :collision: :collision: :collision:" - message: | - ## :star2: :collision: :collision: [${{ env.MESSAGE_HEADER }}] :collision: :collision: :collision: -
- detail - - ```bash - - ${{ env.MESSAGE }} - - ``` - -
- - if: env.BASH_SCRIPT_RESULT != 0 - name: Throw Error - id: "throw-error" - run: | - echo "::group:: human readable validation result" - echo -e "${{ env.MESSAGE }}" - echo "::endgroup::" - exit 1 \ No newline at end of file diff --git a/scripts/ci/shellcheck-install.sh b/scripts/ci/shellcheck-install.sh deleted file mode 100755 index 66558b9..0000000 --- a/scripts/ci/shellcheck-install.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -################################################################### -#Script Name : Shell Check -#Description : Validates Bash / Shell Scripts -#Args : - -#Hint : execute this script from github repository root! -################################################################### -cmd="shellcheck" -################################################################### -# https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-commands-for-github-actions#example-grouping-log-lines -echo "::group:: $(pwd)" - -if [ -n "$GITHUB_WORKSPACE" ]; then - cd "${GITHUB_WORKSPACE}" || exit - cmd="./shellcheck-v${VERSION}/${cmd}" - - if [ -z "${VERSION}" ]; then - echo "::error file={.github/workflows/shellcheck.yaml},line={1},endLine={1},title=Setup::env.VERSION needs to be set!" - echo "::endgroup::" - exit 1 - fi - - if ! curl -sLO "https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.linux.x86_64.tar.xz"; then - echo "::error file={.github/workflows/shellcheck.yaml},line={1},endLine={1},title=Setup::ERROR downloading https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.linux.x86_64.tar.xz!" - echo "::endgroup::" - exit 1 - fi - - if ! tar -xf "shellcheck-v${VERSION}.linux.x86_64.tar.xz"; then - echo "::error file={.github/workflows/shellcheck.yaml},line={1},endLine={1},title=Setup::ERROR unpacking shellcheck-v${VERSION}.linux.x86_64.tar.xz!" - echo "::endgroup::" - exit 1 - fi -fi -echo "\$ ${cmd} -V" -${cmd} -V -echo "::endgroup::" \ No newline at end of file diff --git a/scripts/ci/shellcheck.sh b/scripts/ci/shellcheck.sh deleted file mode 100755 index c334774..0000000 --- a/scripts/ci/shellcheck.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -################################################################### -#Script Name : Shell Check -#Description : Validates Bash / Shell Scripts -#Args : - -#Hint : execute this script from github repository root! -################################################################### -# shellcheck disable=SC1091 -source "$(pwd)/.github/actions/shared-variables.sh" -declare resultPwd newLineString exitCode msgEverythingIsFine - -set +e -echo "The script you are running has:" -echo "basename: [$(basename "$0")]" -echo "dirname : [$(dirname "$0")]" -echo "pwd : [$(pwd)]" - -cmd="shellcheck" -################################################################### -resultPwd=$(pwd) -if [ -n "$GITHUB_WORKSPACE" ]; then - cmd="./shellcheck-v${VERSION}/${cmd}" -fi -################################################################### -declare -a filesToRemove=("spellcheck-parsable.txt") -REMOVE_FILES_IF_EXISTS "$resultPwd" "${filesToRemove[@]}" - -################################################################### -for dir in $(find . -type f -name '*.sh' | sed -r 's|/[^/]+$||' | sort | uniq); do - cmdFat="${cmd} ${dir}/*.sh -a" - { - echo "$newLineString" - echo "Use command to run this check on your local machine!" - echo -e "$cmdFat\n" - } >> "${resultPwd}/pr-status-check-human-friendly.txt" - - echo "\$ $cmdFat" - eval "$cmdFat" >>"${resultPwd}/pr-status-check-human-friendly.txt" - tempQ=$? - if [ $tempQ != 0 ]; then - exitCode=$tempQ - jsonResult=$( ${cmd} "${dir}"/*.sh -f json -a ) - echo "$jsonResult" >> "spellcheck-parsable.txt" 2>&1 - - jq -c '.[]' <<< "$jsonResult" | while read -r i; do - # shellcheck disable=SC2001 - i=$( sed 's/"""/""/g' <<< "$i" ) - - file=$(jq -r '.file' <<< "$i"); - file=$( sed -r 's/\.\///g' <<< "$file" ) - line=$(jq -r '.line' <<< "$i"); - endLine=$(jq -r '.endLine' <<< "$i"); - level=$(jq -r '.level' <<< "$i"); - message=$(jq -r '.message' <<< "$i"); - - case $level in - info | style) - level="notice" - ;; - esac - echo "::${level} file=$file,line=$line,endLine=$endLine::$message" >> "${resultPwd}/github-workflow-commands.txt" - done - else - echo "$msgEverythingIsFine" >> "${resultPwd}/pr-status-check-human-friendly.txt" - fi - -done -exit "$exitCode" -################################################################### \ No newline at end of file