60 lines
2.0 KiB
YAML
60 lines
2.0 KiB
YAML
# BlackRoad OS — Pave Tomorrow.
|
|
# Weekly dependency update check
|
|
name: Dependency Check
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 9 * * 1'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
check-node:
|
|
runs-on: ubuntu-latest
|
|
if: hashFiles('package.json') != ''
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
- run: npm ci
|
|
- name: Check outdated
|
|
id: outdated
|
|
run: |
|
|
OUTDATED=$(npm outdated --json 2>/dev/null || echo "{}")
|
|
COUNT=$(echo "$OUTDATED" | python3 -c "import sys,json; print(len(json.load(sys.stdin)))" 2>/dev/null || echo 0)
|
|
echo "count=$COUNT" >> $GITHUB_OUTPUT
|
|
if [ "$COUNT" -gt 0 ]; then
|
|
echo "$OUTDATED" | python3 -c "
|
|
import sys, json
|
|
deps = json.load(sys.stdin)
|
|
for name, info in deps.items():
|
|
current = info.get('current', '?')
|
|
latest = info.get('latest', '?')
|
|
print(f'- **{name}**: {current} → {latest}')
|
|
" > outdated.md
|
|
fi
|
|
|
|
- name: Create issue if updates found
|
|
if: steps.outdated.outputs.count > 0
|
|
run: |
|
|
BODY=$(cat outdated.md)
|
|
curl -s -X POST "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/issues" \
|
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"title\": \"[Dependencies] ${{ steps.outdated.outputs.count }} packages need updating\",
|
|
\"body\": \"## Outdated Dependencies\n\n$BODY\n\n---\n*Auto-generated by BlackRoad CI*\"
|
|
}"
|
|
|
|
check-python:
|
|
runs-on: ubuntu-latest
|
|
if: hashFiles('requirements.txt') != ''
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
- run: pip install -r requirements.txt
|
|
- name: Check outdated
|
|
run: pip list --outdated --format=columns
|