Skip to content

Commit 8125a33

Browse files
committed
chore: update of common workflows
1 parent 7caa148 commit 8125a33

File tree

6 files changed

+255
-0
lines changed

6 files changed

+255
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
3+
# The workflow template for automatic PR labeler.
4+
# It requires to have a configuration file with labels and conditions to apply them.
5+
# The configuration file should be placed in the .github folder and named auto-labeler-config.yaml.
6+
# Example file can be found there:
7+
# https://github.com/Netcracker/.github/blob/main/config/examples/auto-labeler-config.yaml
8+
9+
name: Automatic PR Labeler
10+
11+
on:
12+
pull_request:
13+
branches: [main]
14+
types:
15+
[opened, reopened, synchronize]
16+
17+
permissions:
18+
pull-requests: write
19+
contents: read
20+
issues: write
21+
22+
jobs:
23+
assign-labels:
24+
if: (github.event.pull_request.merged == false) && (github.event.pull_request.user.login != 'dependabot[bot]') && (github.event.pull_request.user.login != 'github-actions[bot]')
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
with:
29+
persist-credentials: false
30+
31+
- name: "Execute assign labels"
32+
id: action-assign-labels
33+
uses: mauroalderete/action-assign-labels@v1
34+
with:
35+
pull-request-number: ${{ github.event.pull_request.number }}
36+
github-token: ${{ github.token }}
37+
conventional-commits: "./.github/auto-labeler-config.yaml"
38+
maintain-labels-not-matched: true
39+
apply-changes: ${{ github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id }}
40+
- name: "Drop warning if PR from fork"
41+
if: ${{ github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id }}
42+
run: |
43+
{
44+
echo "⚠️ Pull request from fork! ⚠️";
45+
echo "Labels will not be applied to PR. Assign them manually please.";
46+
echo "Labels to assign: ${{ steps.action-assign-labels.outputs.labels-next }}";
47+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/cla.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: CLA Assistant
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_target:
7+
types: [opened, closed, synchronize]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
CLAAssistant:
14+
if: github.event.pull_request.draft == false
15+
permissions:
16+
actions: write
17+
contents: write
18+
pull-requests: write
19+
statuses: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: "CLA Assistant"
23+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
24+
uses: contributor-assistant/github-action@v2.6.1
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
PERSONAL_ACCESS_TOKEN: ${{ secrets.CLA_ACCESS_TOKEN }}
28+
with:
29+
path-to-signatures: 'signatures/version1/cla.json'
30+
path-to-document: 'https://github.com/Netcracker/qubership-github-workflows/blob/main/CLA/cla.md'
31+
# branch should not be protected
32+
branch: 'main'
33+
allowlist: NetcrackerCLPLCI,web-flow,bot*
34+
remote-repository-name: cla-storage
35+
remote-organization-name: Netcracker
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)