Skip to content

Commit 31de134

Browse files
committed
chore: update of common workflows
1 parent 751c447 commit 31de134

File tree

2 files changed

+60
-18
lines changed

2 files changed

+60
-18
lines changed

.github/workflows/link-checker.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
push: null
66
repository_dispatch: null
77
workflow_dispatch: null
8-
8+
permissions:
9+
contents: read
910
jobs:
1011
linkChecker:
1112
runs-on: ubuntu-latest

.github/workflows/super-linter.yaml

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,66 @@ permissions:
2929
contents: read
3030

3131
jobs:
32+
prepare-configs:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: "Get the common linters configuration"
36+
uses: actions/checkout@v4
37+
with:
38+
ref: main # fix/superlinter-config
39+
repository: netcracker/.github
40+
sparse-checkout: |
41+
config/linters
42+
- name: "Upload the common linters configsuration"
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: linter-config
46+
path: "${{ github.workspace }}/config"
47+
include-hidden-files: true
3248
run-lint:
49+
needs: [prepare-configs]
3350
runs-on: ubuntu-latest
51+
permissions:
52+
contents: read
53+
packages: read
54+
# To report GitHub Actions status checks
55+
statuses: write
3456
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
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
with:
60+
# Full git history is needed to get a proper list of changed files within `super-linter`
61+
fetch-depth: 0
62+
- name: "Get the common linters configuration"
63+
uses: actions/download-artifact@v4
64+
id: download
65+
with:
66+
name: linter-config
67+
path: /tmp/linter-config
68+
- name: "Apply the common linters configuration"
69+
if: ${{ steps.download.outputs.download-path != '' }}
70+
run: |
71+
mkdir -p ./.github/linters
72+
cp --update=none -vR /tmp/linter-config/linters/* ./.github/linters
4073
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
74+
- name: "Load super-linter environment file"
75+
shell: bash
76+
run: |
77+
# shellcheck disable=2086
78+
if [ -f "${GITHUB_WORKSPACE}/.github/super-linter.env" ]; then
79+
echo "Applying local linter environment:"
80+
grep "\S" ${GITHUB_WORKSPACE}/.github/super-linter.env | grep -v "^#"
81+
grep "\S" ${GITHUB_WORKSPACE}/.github/super-linter.env | grep -v "^#" >> $GITHUB_ENV
82+
elif [ -f "/tmp/linter-config/linters/super-linter.env" ]; then
83+
echo "::warning:: Local linter environment file .github/super-linter.env is not found"
84+
echo "Applying common linter environment:"
85+
grep "\S" /tmp/linter-config/linters/super-linter.env | grep -v "^#"
86+
grep "\S" /tmp/linter-config/linters/super-linter.env | grep -v "^#" >> $GITHUB_ENV
87+
fi
4888
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 }}
89+
- name: Lint Code Base
90+
uses: super-linter/super-linter/[email protected]
91+
env:
92+
VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }}
93+
# To report GitHub Actions status checks
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)