Skip to content

Commit 3c3c89f

Browse files
NetcrackerCLPLCIweb-flowPavelYadrov
authored
chore: update of common workflows (#32)
* chore: update of common workflows * chore: update of common workflows --------- Co-authored-by: NetcrackerCLPLCI <noreply@github.com> Co-authored-by: PavelYadrov <61824537+PavelYadrov@users.noreply.github.com>
1 parent f811b80 commit 3c3c89f

File tree

7 files changed

+207
-7
lines changed

7 files changed

+207
-7
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,17 @@ 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
3133
uses: mauroalderete/action-assign-labels@v1
3234
with:
3335
pull-request-number: ${{ github.event.pull_request.number }}
3436
github-token: ${{ github.token }}
35-
conventional-commits: ".github/workflows/automatic-pr-labeler.yaml"
37+
conventional-commits: "./.github/auto-labeler-config.yaml"
3638
maintain-labels-not-matched: true
3739
apply-changes: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }}
3840
- name: "Drop warning if PR from fork"
@@ -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: 7 additions & 4 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
11-
contents: write
12-
pull-requests: write
13-
statuses: write
10+
contents: read
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"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Link Checker
3+
4+
on:
5+
push: null
6+
repository_dispatch: null
7+
workflow_dispatch: null
8+
permissions:
9+
contents: read
10+
jobs:
11+
linkChecker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Link Checker
17+
id: lychee
18+
uses: lycheeverse/lychee-action@v2
19+
with:
20+
args: --base . --verbose --no-progress './**/*.md' --accept 100..=103,200..=299,429
21+
format: markdown
22+
fail: true
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
3+
name: Conventional Commits PR Check
4+
5+
on:
6+
pull_request:
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
12+
permissions:
13+
pull-requests: read
14+
jobs:
15+
build:
16+
name: Conventional Commits
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
with:
21+
persist-credentials: false
22+
23+
- uses: webiny/action-conventional-commits@v1.3.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
3+
name: "Lint PR Title"
4+
5+
on:
6+
pull_request:
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
- reopened
12+
13+
permissions:
14+
pull-requests: read
15+
16+
jobs:
17+
main:
18+
name: Validate PR title
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: amannn/action-semantic-pull-request@v6
22+
env:
23+
GITHUB_TOKEN: ${{ github.token }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Profanity filter
3+
4+
on:
5+
issue_comment:
6+
types: [created, edited]
7+
issues:
8+
types: [opened, edited, reopened]
9+
pull_request:
10+
types: [opened, edited, reopened]
11+
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
16+
jobs:
17+
apply-filter:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Scan issue or pull request for profanity
21+
# Conditionally run the step if the actor isn't a bot
22+
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'github-actions[bot]' }}
23+
uses: IEvangelist/profanity-filter@9.07
24+
id: profanity-filter
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
# See https://bit.ly/potty-mouth-replacement-strategies
28+
replacement-strategy: middle-asterisk # See Replacement strategy
29+
custom-profane-words-url: https://github.com/Hesham-Elbadawi/list-of-banned-words/raw/refs/heads/master/ru
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
# This workflow executes several linters on changed files based on languages used in your code base whenever
3+
# you push a code or open a pull request.
4+
#
5+
# You can adjust the behavior by modifying this file.
6+
# For more information, see:
7+
# https://github.com/super-linter/super-linter
8+
# Configuration file for super-linter example:
9+
# .github/super-linter.env
10+
# Configuration files for individual linters should be placed in .github/linters
11+
12+
name: Lint Code Base
13+
14+
on:
15+
push:
16+
branches:
17+
- '**'
18+
pull_request:
19+
branches:
20+
- '**'
21+
workflow_dispatch:
22+
inputs:
23+
full_scan:
24+
type: boolean
25+
default: false
26+
required: false
27+
description: "Lint all codebase"
28+
permissions:
29+
contents: read
30+
31+
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
49+
run-lint:
50+
needs: [prepare-configs]
51+
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
packages: read
55+
# To report GitHub Actions status checks
56+
statuses: write
57+
steps:
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
90+
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 }}
98+

0 commit comments

Comments
 (0)