Skip to content

Commit 4abe4cb

Browse files
committed
feat(ci): add github action pre-commit
1 parent fedf9f8 commit 4abe4cb

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Description
2+
[Describe what this PR does and why]
3+
4+
**Related Issue:** Fixes #[issue_number] or Relates to #[issue_number]
5+
6+
**Security Considerations:** [Check if API keys or sensitive credentials are exposed in code/logs]
7+
8+
## Type of Change
9+
- [ ] Bug fix
10+
- [ ] New feature
11+
- [ ] Breaking change
12+
- [ ] Documentation
13+
- [ ] Refactoring
14+
15+
## Component(s) Affected
16+
- [ ] Model
17+
- [ ] Application
18+
- [ ] Common
19+
- [ ] Documentation
20+
- [ ] Tests
21+
- [ ] CI/CD
22+
23+
## Checklist
24+
- [ ] Pre-commit hooks pass
25+
- [ ] Tests pass locally
26+
- [ ] Documentation updated (if needed)
27+
- [ ] Ready for review
28+
29+
## Testing
30+
[How to test these changes]
31+
32+
## Additional Notes
33+
[Optional: any other context]

.github/workflows/pre-commit.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Pre-commit Checks
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: true
10+
env:
11+
OS: ubuntu-latest
12+
PYTHON: '3.8'
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.8'
19+
- name: Update setuptools and wheel
20+
run: |
21+
pip install setuptools==68.2.2 wheel==0.41.2
22+
- name: Install dashscope python sdk
23+
run: |
24+
pip install -r requirements.txt
25+
- name: Install pre-commit hooks
26+
run: |
27+
pre-commit install
28+
- name: Run pre-commit
29+
run: |
30+
pre-commit run --all-files > pre-commit.log 2>&1 || true
31+
cat pre-commit.log
32+
if grep -q Failed pre-commit.log; then
33+
echo -e "\e[41m [**FAIL**] Please install pre-commit and format your code first. \e[0m"
34+
exit 1
35+
fi
36+
echo -e "\e[46m ********************************Passed******************************** \e[0m"

0 commit comments

Comments
 (0)