Skip to content

Commit ec400e7

Browse files
chore: update of common workflows (#40)
Co-authored-by: NetcrackerCLPLCI <noreply@github.com>
1 parent fb39c84 commit ec400e7

File tree

6 files changed

+78
-25
lines changed

6 files changed

+78
-25
lines changed

.github/workflows/automatic-pr-labeler.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
if: (github.event.pull_request.merged == false) && (github.event.pull_request.user.login != 'dependabot[bot]') && (github.event.pull_request.user.login != 'github-actions[bot]')
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
with:
29+
persist-credentials: false
2830

2931
- name: "Execute assign labels"
3032
id: action-assign-labels
@@ -42,4 +44,4 @@ jobs:
4244
echo "⚠️ Pull request from fork! ⚠️";
4345
echo "Labels will not be applied to PR. Assign them manually please.";
4446
echo "Labels to assign: ${{ steps.action-assign-labels.outputs.labels-next }}";
45-
} >> $GITHUB_STEP_SUMMARY
47+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/cla.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ on:
77
types: [opened, closed, synchronize]
88

99
permissions:
10-
actions: write
1110
contents: read
12-
pull-requests: write
13-
statuses: write
1411

1512
jobs:
1613
CLAAssistant:
14+
if: github.event.pull_request.draft == false
15+
permissions:
16+
actions: write
17+
contents: write
18+
pull-requests: write
19+
statuses: write
1720
runs-on: ubuntu-latest
1821
steps:
1922
- name: "CLA Assistant"

.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/pr-conventional-commits.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
name: Conventional Commits
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
with:
21+
persist-credentials: false
2022

2123
- uses: webiny/action-conventional-commits@v1.3.0

.github/workflows/pr-lint-title.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
name: Validate PR title
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: amannn/action-semantic-pull-request@v5
21+
- uses: amannn/action-semantic-pull-request@v6
2222
env:
2323
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/super-linter.yaml

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,70 @@ 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@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

Comments
 (0)