-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (59 loc) · 1.88 KB
/
packages-anaconda-org.yml
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
name: Fetch anaconda.org stats
on:
schedule:
- cron: '0 3,9,15,21 * * *'
workflow_dispatch:
pull_request:
jobs:
fetch-anaconda-org-stats:
name: Fetch anaconda.org stats
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check
id: check
run: |
pip install \
ntplib
time="$(
export PYTHONPATH="$( pwd )/src"
python -m package_downloads.ntp_time
)"
if git ls-remote --exit-code --quiet --tags -- origin "${time}" ; then
echo "skip=1" >> "${GITHUB_OUTPUT}"
else
echo "skip=0" >> "${GITHUB_OUTPUT}"
fi
- if: ${{ github.ref != 'refs/heads/main' || steps.check.outputs.skip == '0' }}
name: Fetch
id: fetch
run: |
set -x
ref="$( git show-ref --head --hash HEAD )"
pip install \
ntplib \
aiohttp requests urllib3 \
pandas
git fetch --depth=1 origin data:data
git checkout --quiet data
git checkout --quiet "${ref}" -- ./src
time="$(
export PYTHONPATH="$( pwd )/src"
python -m package_downloads.stats_from_anaconda_org
)"
echo "time=${time}" >> "${GITHUB_OUTPUT}"
- if: ${{ github.ref != 'refs/heads/main' || steps.check.outputs.skip == '0' }}
name: Add changes, commit
run: |
set -x
git config user.name github-actions
git config user.email github-actions@github.com
git add -A ./package-downloads
git rm -rf ./src
git status --short | grep -o ^. | sort | uniq -c
git commit -qm 'Update package download stats, ${{ steps.fetch.outputs.time }}'
git tag '${{ steps.fetch.outputs.time }}'
- if: ${{ github.ref == 'refs/heads/main' && steps.check.outputs.skip == '0' }}
name: Push changes
run: |
git push --tags origin data:data