38
38
echo "Source Branch ${{ github.event.pull_request.head.ref }}"
39
39
echo "Target Branch ${{ github.event.pull_request.base.ref }}"
40
40
echo "Error: Source and Target Branches are the same. Please ensure they are different."
41
+ echo "Error: Close this PR and try again."
41
42
exit 1
42
43
44
+ - name : Set up Python
45
+ uses : actions/setup-python@v5
46
+ with :
47
+ python-version : 3.9
48
+
49
+ - name : Install dependencies
50
+ run : |
51
+ python -m pip install --upgrade pip
52
+ pip install flake8 black pydocstyle flake8-docstrings
53
+
54
+ - name : Run Black Formatter Check
55
+ run : |
56
+ black --check .
57
+
58
+ - name : Run Flake8 Linter
59
+ run : |
60
+ flake8 --docstring-convention google switchmap bin setup tests .github --ignore E402,E722,E203,F401,W503
61
+
62
+ - name : Run pydocstyle
63
+ run : |
64
+ pydocstyle switchmap setup bin tests --convention=google --add-ignore=D415,D205
65
+
43
66
Check-Sensitive-Files :
44
67
if : ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }}
45
68
name : Checks if sensitive files have been changed without authorization
@@ -57,21 +80,28 @@ jobs:
57
80
.github/**
58
81
package.json
59
82
package-lock.json
83
+ yaml.lock
60
84
.gitignore
61
85
.nojekyll
62
86
CODEOWNERS
63
87
LICENSE
64
88
.coderabbit.yaml
65
- ./*.md
66
89
docs/CNAME
67
90
docs/static/CNAME
68
91
docs/package.json
69
92
docs/sidebar*.js
70
93
docs/docusaurus.config.js
71
94
docs/babel.config.js
72
95
docs/tsconfig.json
73
- .coderabbit.yaml
74
-
96
+ CODE_OF_CONDUCT.md
97
+ CODE_STYLE.md
98
+ CONTRIBUTING.md
99
+ DOCUMENTATION.md
100
+ INSTALLATION.md
101
+ ISSUE_GUIDELINES.md
102
+ PR_GUIDELINES.md
103
+ README.md
104
+ requirements.txt
75
105
- name : List all changed unauthorized files
76
106
if : steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true'
77
107
env :
@@ -142,4 +172,57 @@ jobs:
142
172
if : github.event.pull_request.base.ref != 'develop'
143
173
run : |
144
174
echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md"
175
+ echo "Error: Close this PR and try again."
145
176
exit 1
177
+
178
+ Validate-CodeRabbit :
179
+ name : Validate CodeRabbit Approval
180
+ runs-on : ubuntu-latest
181
+ if : github.actor != 'dependabot[bot]'
182
+ needs : [Code-Quality-Checks, Test-Docusaurus-Deployment]
183
+ steps :
184
+ - name : Checkout Repository
185
+ uses : actions/checkout@v4
186
+ - name : Validate CodeRabbit.ai Approval
187
+ run : |
188
+ chmod +x $GITHUB_WORKSPACE/.github/workflows/scripts/validate-coderabbit.sh
189
+ $GITHUB_WORKSPACE/.github/workflows/scripts/validate-coderabbit.sh
190
+ env :
191
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
192
+ PR_NUMBER : ${{ github.event.pull_request.number }}
193
+ GITHUB_REPOSITORY : ${{ github.repository }}
194
+
195
+ Docstring-Compliance :
196
+ name : Check Docstring Compliance
197
+ runs-on : ubuntu-latest
198
+ needs : [Code-Quality-Checks]
199
+ steps :
200
+ - name : Checkout
201
+ uses : actions/checkout@v4
202
+ with :
203
+ fetch-depth : 0
204
+
205
+ - name : Set up Python 3.11
206
+ uses : actions/setup-python@v4
207
+ with :
208
+ python-version : 3.11
209
+
210
+ - name : Cache pip packages
211
+ uses : actions/cache@v4
212
+ with :
213
+ path : ~/.cache/pip
214
+ key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
215
+ restore-keys : |
216
+ ${{ runner.os }}-pip-
217
+
218
+ - name : Install dependencies
219
+ run : |
220
+ python3 -m venv venv
221
+ source venv/bin/activate
222
+ python -m pip install --upgrade pip
223
+ pip install -r requirements.txt
224
+
225
+ - name : Run docstring compliance check
226
+ run : |
227
+ source venv/bin/activate
228
+ python .github/workflows/scripts/check_docstrings.py --directories switchmap setup bin tests .github
0 commit comments