Skip to content

Delete scripts directory #6

Delete scripts directory

Delete scripts directory #6

Workflow file for this run

name: PR Validation
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
checks: write
pull-requests: write
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
tests: ${{ steps.changes.outputs.tests }}
docs: ${{ steps.changes.outputs.docs }}
workflows: ${{ steps.changes.outputs.workflows }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'src/**'
- 'setup.py'
- 'requirements.txt'
tests:
- 'tests/**'
- 'pytest.ini'
docs:
- '*.md'
- 'docs/**'
workflows:
- '.github/**'
validate-pr:
name: Validate PR
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate PR title
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
# Check if title follows conventional commits
if [[ ! "$PR_TITLE" =~ ^(feat|fix|docs|style|refactor|perf|test|chore|ci|build)(\(.+\))?!?:\ .+ ]]; then
echo "::error::PR title should follow conventional commits format"
echo "Examples:"
echo " feat: add new export format"
echo " fix: resolve memory leak in parser"
echo " docs: update installation instructions"
exit 1
fi
- name: Check PR description
run: |
if [ -z "${{ github.event.pull_request.body }}" ]; then
echo "::error::PR description is required"
exit 1
fi
quick-test:
name: Quick Test
runs-on: ubuntu-latest
needs: [changes, validate-pr]
if: needs.changes.outputs.src == 'true' || needs.changes.outputs.tests == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio flake8
pip install -e .
- name: Quick syntax check
run: |
python -m py_compile src/analyzeMFT/*.py
python -m py_compile tests/*.py
- name: Lint changed files
if: needs.changes.outputs.src == 'true'
run: |
flake8 src/ --max-line-length=120 --ignore=E203,W503
- name: Run critical tests
run: |
pytest tests/test_constants.py tests/test_validators.py tests/test_windows_time.py -v
security-scan:
name: Security Scan
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install security tools
run: |
pip install bandit safety
- name: Run bandit
run: |
bandit -r src/ -ll -f json
continue-on-error: true
- name: Check dependencies
run: |
pip install -r requirements.txt
safety check
continue-on-error: true
approve-dependabot:
name: Auto-approve Dependabot
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Approve dependabot PR
run: |
gh pr review --approve "${{ github.event.pull_request.html_url }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}