@@ -29,25 +29,70 @@ permissions:
2929 contents : read
3030
3131jobs :
32+ prepare-configs :
33+ runs-on : ubuntu-latest
34+ steps :
35+ - name : " Get the common linters configuration"
36+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37+ with :
38+ ref : main # fix/superlinter-config
39+ repository : netcracker/.github
40+ persist-credentials : false
41+ sparse-checkout : |
42+ config/linters
43+ - name : " Upload the common linters configuration"
44+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
45+ with :
46+ name : linter-config
47+ path : " ${{ github.workspace }}/config"
48+ include-hidden-files : true
3249 run-lint :
50+ needs : [prepare-configs]
3351 runs-on : ubuntu-latest
52+ permissions :
53+ contents : read
54+ packages : read
55+ # To report GitHub Actions status checks
56+ statuses : write
3457 steps :
35- - name : Checkout code
36- uses : actions/checkout@v4
37- with :
38- # Full git history is needed to get a proper list of changed files within `super-linter`
39- fetch-depth : 0
58+ - name : Checkout code
59+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
60+ with :
61+ # Full git history is needed to get a proper list of changed files within `super-linter`
62+ fetch-depth : 0
63+ persist-credentials : false
64+ - name : " Get the common linters configuration"
65+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
66+ id : download
67+ with :
68+ name : linter-config
69+ path : /tmp/linter-config
70+ - name : " Apply the common linters configuration"
71+ if : ${{ steps.download.outputs.download-path != '' }}
72+ run : |
73+ mkdir -p ./.github/linters
74+ cp --update=none -vRT /tmp/linter-config/linters ./.github/linters
75+
76+ - name : " Load super-linter environment file"
77+ shell : bash
78+ run : |
79+ # shellcheck disable=2086
80+ if [ -f "${GITHUB_WORKSPACE}/.github/super-linter.env" ]; then
81+ echo "Applying local linter environment:"
82+ grep "\S" ${GITHUB_WORKSPACE}/.github/super-linter.env | grep -v "^#"
83+ grep "\S" ${GITHUB_WORKSPACE}/.github/super-linter.env | grep -v "^#" >> $GITHUB_ENV
84+ elif [ -f "/tmp/linter-config/linters/super-linter.env" ]; then
85+ echo "::warning:: Local linter environment file .github/super-linter.env is not found"
86+ echo "Applying common linter environment:"
87+ grep "\S" /tmp/linter-config/linters/super-linter.env | grep -v "^#"
88+ grep "\S" /tmp/linter-config/linters/super-linter.env | grep -v "^#" >> $GITHUB_ENV
89+ fi
4090
41- - name : " Load super-linter environment file "
42- run : |
43- # shellcheck disable=2086
44- if [ -f "./.github/super-linter.env" ]; then
45- grep "\S" ./.github/super-linter.env | grep -v "^#"
46- grep "\S" ./.github/super-linter.env | grep -v "^#" >> $GITHUB_ENV
47- fi
91+ - name : Lint Code Base
92+ uses : super-linter/super-linter/slim@ffde3b2b33b745cb612d787f669ef9442b1339a6 # v8.1.0
93+ env :
94+ VALIDATE_ALL_CODEBASE : ${{ inputs.full_scan || false }}
95+ # To report GitHub Actions status checks
96+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
97+ DEFAULT_BRANCH : ${{ github.event.pull_request.base.ref || github.event.push.ref }}
4898
49- - name : Lint Code Base
50- uses : super-linter/super-linter@v7
51- env :
52- VALIDATE_ALL_CODEBASE : ${{ inputs.full_scan || false }}
53- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments