File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Python Validate & Build
2+
3+ on :
4+ push :
5+ paths :
6+ - ' requirements.txt'
7+ - ' pyproject.toml'
8+ - ' .github/workflows/python-validate.yml'
9+ pull_request :
10+ paths :
11+ - ' requirements.txt'
12+ - ' pyproject.toml'
13+
14+ jobs :
15+ validate :
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v3
19+
20+ - name : Set up Python
21+ uses : actions/setup-python@v4
22+ with :
23+ python-version : 3.12
24+
25+ - name : Install system dependencies
26+ run : |
27+ sudo apt-get update
28+ sudo apt-get install -y \
29+ pkg-config \
30+ libcairo2-dev \
31+ libpango1.0-dev \
32+ libgdk-pixbuf2.0-dev \
33+ libffi-dev \
34+ shared-mime-info
35+
36+ - name : Install pip-tools
37+ run : pip install --upgrade pip pip-tools
38+
39+ - name : Validate requirements
40+ id : validate
41+ run : |
42+ if pip-compile --dry-run -o requirements.out requirements.txt; then
43+ echo "::debug::Python validate no broken dependencies"
44+ echo "valid=true" >> "$GITHUB_OUTPUT"
45+ else
46+ echo "valid=false" >> "$GITHUB_OUTPUT"
47+ echo "### :warning: Python validation failed in repository root" >> $GITHUB_STEP_SUMMARY
48+ echo "We were unable to validate a Python project in the repository root. Make sure all system dependencies are installed." >> $GITHUB_STEP_SUMMARY
49+ exit 1
50+ fi
51+
52+ - name : Auto-approve Dependabot PRs
53+ if : github.actor == 'dependabot[bot]' && steps.validate.outputs.valid == 'true'
54+ uses : hmarr/auto-approve-action@v2.1.0
55+ with :
56+ github-token : ${{ secrets.GITHUB_TOKEN }}
57+
You can’t perform that action at this time.
0 commit comments