Files
linearvoid/.gitea/workflows/dependency-updates.yml
T

76 lines
2.5 KiB
YAML

name: Dependency Updates
on:
schedule:
- cron: "0 2 * * 1" # Every Monday at 2 AM UTC
workflow_dispatch:
jobs:
update-dependencies:
runs-on: [ubuntu-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Update Frontend Dependencies
run: |
cd frontend
npm update
npm audit fix || true
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: true
- name: Update Go Dependencies
run: |
cd backend/playout && go get -u ./... && go mod tidy
cd ../chat && go get -u ./... && go mod tidy
- name: Commit and push changes
run: |
git config user.name "linearvoid-bot"
git config user.email "bot@linearvoid.local"
git add frontend/package*.json backend/playout/go.* backend/chat/go.*
if git diff --cached --quiet; then
echo "No dependency changes detected."
exit 0
fi
git commit -m "chore: update dependencies"
git push origin HEAD:dependency-updates --force
- name: Create Pull Request via Gitea API
run: |
RESPONSE=$(curl -s -o /tmp/pr-response.json -w "%{http_code}" \
-X POST "$CI_SERVER_URL/api/v1/repos/zwitschi/linearvoid/pulls" \
-H "Authorization: token ${{ secrets.CI_REGISTRY_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"title": "chore: weekly dependency updates",
"head": "dependency-updates",
"base": "main",
"body": "Automated weekly dependency updates.\n\nThis PR updates:\n- Frontend npm dependencies\n- Go module dependencies\n\nPlease review the changes and ensure tests pass before merging."
}')
if [ "$RESPONSE" -eq 201 ]; then
PR_URL=$(cat /tmp/pr-response.json | jq -r '.html_url')
echo "PR created: $PR_URL"
elif [ "$RESPONSE" -eq 409 ]; then
echo "PR already exists. Pushing updated commits..."
git push origin dependency-updates --force
else
echo "Error creating PR (HTTP $RESPONSE):"
cat /tmp/pr-response.json
exit 1
fi