forked from langchain-ai/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (98 loc) · 3.64 KB
/
update-package-downloads.yml
File metadata and controls
118 lines (98 loc) · 3.64 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
name: Update Package Downloads
on:
schedule:
# Run every Sunday at 11:59 PM UTC
- cron: "59 23 * * 0"
workflow_dispatch: # Allow manual triggering
jobs:
generate-downloads:
name: Generate package download counts
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.13 + uv
uses: "./.github/actions/uv_setup"
with:
python-version: "3.13"
- name: Install dependencies
run: |
uv sync --group test
- name: Update download counts
run: |
# Note: Script only updates packages if their downloads_updated_at
# timestamp is older than 24 hours to avoid hammering pepy.tech.
# If run manually within 24 hours of a previous update, no changes
# will be detected and the workflow will exit early.
uv run scripts/packages_yml_get_downloads.py
- name: Generate partner package table
run: |
uv run python pipeline/tools/partner_pkg_table.py
- name: Upload updated files as artifact
uses: actions/upload-artifact@v4
with:
name: packages-yml
path: |
reference/packages.yml
src/oss/python/integrations/providers/overview.mdx
retention-days: 1
commit-downloads:
name: Create PR with updated download counts
needs: generate-downloads
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v5
- name: Download updated files
uses: actions/download-artifact@v4
with:
name: packages-yml
path: .
- name: Create PR with changes
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Check if there are changes
if git diff --quiet reference/packages.yml src/oss/python/integrations/providers/overview.mdx; then
echo "No changes to commit"
exit 0
fi
# Create a new branch with timestamp
BRANCH_NAME="chore/update-package-downloads-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$BRANCH_NAME"
# Commit changes
git add reference/packages.yml src/oss/python/integrations/providers/overview.mdx
git commit -m "$(cat <<'EOF'
chore: update package download counts
🤖 Automated update of package download statistics from pepy.tech
and regenerated provider overview page
Generated with GitHub Actions workflow update-package-downloads.yml
EOF
)"
# Push branch
git push origin "$BRANCH_NAME"
# Create PR
gh pr create \
--title "chore: update package download counts" \
--body "$(cat <<'EOF'
## Summary
Automated update of package download statistics from pepy.tech
## Details
- Updates download counts in `reference/packages.yml`
- Regenerates provider overview page at `src/oss/python/integrations/providers/overview.mdx`
- Generated by GitHub Actions workflow `update-package-downloads.yml`
- Scheduled to run every Sunday at 11:59 PM UTC
🤖 This PR was created automatically by GitHub Actions
EOF
)" \
--base main \
--head "$BRANCH_NAME"
# Enable auto-merge with squash
gh pr merge "$BRANCH_NAME" --auto --squash