acctonbmc: Add WEDGE800{B|C}NHP support to CIT #310
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: lint_pr | |
| on: pull_request | |
| jobs: | |
| run-shellcheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Unfortunately some shell files don't have an extension. | |
| # This means we need to checkout the entire repo just to see if we need | |
| # to lint anything... | |
| - uses: actions/checkout@v3 | |
| name: Checkout Repo | |
| - name: Get PR File List | |
| shell: bash | |
| run: | | |
| URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files" | |
| curl -s -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $URL | jq -r '.[] | .filename' > git_diff.log | |
| cat git_diff.log | |
| - name: Check for shell files | |
| shell: bash | |
| run : | | |
| SHELL_FILE_LIST="/tmp/shellcheck_file_list.log" | |
| # Get all the shell files. | |
| FILE_PATHS=$(cat git_diff.log) | |
| for FILE_PATH in $FILE_PATHS | |
| do | |
| file_type="$(file -b $FILE_PATH)" | |
| echo $file_type | |
| sub_str='shell' | |
| if [[ "$file_type" == *"$sub_str"* ]]; then | |
| echo "$FILE_PATH" >> $SHELL_FILE_LIST | |
| fi | |
| done | |
| if [ -s $SHELL_FILE_LIST ]; then | |
| echo "Shell files kept:" | |
| cat $SHELL_FILE_LIST | |
| fi | |
| if [ -s $SHELL_FILE_LIST ]; then | |
| echo "contains_shell_files=true" >> "$GITHUB_ENV" | |
| else | |
| echo "contains_shell_files=false" >> "$GITHUB_ENV" | |
| fi | |
| - name: Install shellcheck | |
| if: env.contains_shell_files == 'true' | |
| run: sudo apt-get install -y shellcheck | |
| - name: Run shellcheck on Modified Source Files | |
| if: env.contains_shell_files == 'true' | |
| continue-on-error: true | |
| shell: bash | |
| run: | | |
| echo "Files to check:" | |
| cat /tmp/shellcheck_file_list.log | |
| FILE_PATHS=$(cat /tmp/shellcheck_file_list.log) | |
| for FILE_PATH in $FILE_PATHS | |
| do | |
| options=( | |
| "--format=gcc" | |
| "--exclude=SC1091") | |
| # Shellcheck will throw an error if a file fails, github actions don't like that... | |
| shellcheck "${options[@]}" $FILE_PATH >> /tmp/shellcheck.log || true | |
| done | |
| echo "Errors Found:" | |
| cat /tmp/shellcheck.log | |
| - uses: actions/upload-artifact@master | |
| name: Upload shellcheck error log | |
| if: env.contains_shell_files == 'true' | |
| with: | |
| name: shellcheck-output | |
| path: /tmp/shellcheck.log | |
| - name: Check for shellcheck output | |
| if: env.contains_shell_files == 'true' | |
| run : | | |
| if [ -s /tmp/shellcheck.log ]; then | |
| exit 1 | |
| fi | |
| Aggregate-Lint-Output: | |
| needs: [run-shellcheck] | |
| if: | | |
| always() && needs.run-shellcheck.result == 'failure' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| name: Checkout Repo | |
| - uses: reviewdog/action-setup@v1 | |
| with: | |
| reviewdog_version: latest | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: /tmp/artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| working-directory: /tmp/artifacts | |
| - name: Run reviewdog | |
| env: | |
| REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| SHELL_FILE=/tmp/artifacts/shellcheck-output/shellcheck.log | |
| if test -f "$SHELL_FILE"; then | |
| cat "$SHELL_FILE" | reviewdog -efm="%f:%l:%c:%m" -filter-mode=nofilter -reporter=github-pr-check | |
| fi |