-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (68 loc) · 2.41 KB
/
Copy pathupdate-dependencies.yml
File metadata and controls
83 lines (68 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Update dependencies
on:
schedule:
# Run every 15 minutes
- cron: '*/15 * * * *'
workflow_dispatch: # Allow manual triggering
jobs:
update-dependencies:
name: File update PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v6
# Checkout main branch
with:
ref: main
token: ${{ steps.app-token.outputs.token }}
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Generate API clients
run: |
# Generate clients with correct naming before updating dependencies
./scripts/generate-clients.sh
- name: Update dependencies
id: update
run: |
# Run the update command
make update
# Check if there are changes
if [[ -z $(git status --porcelain) ]]; then
echo "No changes detected"
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Create pull request
if: steps.update.outputs.changes_detected == 'true'
run: |
git config --global user.name "policyengine-auto"
git config --global user.email "policyengine-auto@users.noreply.github.com"
git checkout -b update-dependencies
git add .
git commit -m "Update dependencies"
git push origin update-dependencies --force
# Try to create PR, ignore if it already exists
gh pr create \
--title "Update dependencies" \
--body "Automated dependency updates
This PR was automatically created by the dependency update workflow.
Last updated: $(date)" \
--base main \
--head update-dependencies || echo "PR may already exist, continuing..."
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}