Ankit devops #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Quality Checks | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: commitcheck-frappe-${{ github.event_name }}-${{ github.event.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| commit-lint: | |
| name: 'Semantic Commits' | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 200 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| check-latest: true | |
| - name: Check commit titles | |
| run: | | |
| npm install @commitlint/cli @commitlint/config-conventional | |
| npx commitlint --verbose --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} | |
| docs-required: | |
| name: 'Documentation Required' | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: 'Setup Environment' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - uses: actions/checkout@v4 | |
| - name: Validate Docs | |
| env: | |
| PR_NUMBER: ${{ github.event.number }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: | | |
| pip install requests --quiet | |
| # Check if PR number is valid | |
| if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" = "null" ]; then | |
| echo "No valid PR number found. Skipping documentation check. ✅" | |
| exit 0 | |
| fi | |
| # Run documentation checker with error handling | |
| python $GITHUB_WORKSPACE/.github/helper/documentation.py $PR_NUMBER || { | |
| echo "Documentation checker failed, but continuing workflow. ⚠️" | |
| exit 0 | |
| } | |
| linter: | |
| name: 'Semgrep Rules' | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| cache: pip | |
| - name: Download Semgrep rules | |
| run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules | |
| - name: Run Semgrep rules | |
| run: | | |
| pip install semgrep | |
| semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness | |
| precommit: | |
| name: 'Pre-Commit' | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| cache: pip | |
| - uses: pre-commit/action@v3.0.1 | |
| - name: Check for pre-commit config | |
| run: | | |
| if [ ! -f .pre-commit-config.yaml ]; then | |
| echo "Pre-commit config not found. Downloading..." | |
| curl -o .pre-commit-config.yaml https://raw.githubusercontent.com/dhwani-ris/frappe-pre-commit/main/examples/.pre-commit-config.yaml | |
| else | |
| echo "Pre-commit config already exists." | |
| fi | |
| - name: Install pre-commit | |
| run: pip install pre-commit | |
| - name: Run pre-commit | |
| run: pre-commit run --all-files |