-
Notifications
You must be signed in to change notification settings - Fork 7
41 lines (40 loc) · 1.95 KB
/
update_data.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
name: Update Data
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '5 12 * * 0'
jobs:
build:
name: 'Update Data'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
persist-credentials: false
- name: Download index of GitHub Release info (filtered for download counts)
uses: past-due/fetch-release-info@master
with:
github_repo: 'Warzone2100/warzone2100'
github_token: '${{ secrets.GITHUB_TOKEN }}'
github_release_id: ''
fetch_release_index: true
filter_release_keys: '["author", "url", "assets_url", "upload_url", "html_url", "node_id", "target_commitish", "name", "draft", "created_at", "published_at", "tarball_url", "zipball_url", "body"]'
filter_asset_keys: '["url", "id", "node_id", "label", "state", "content_type", "size", "created_at", "updated_at", "uploader", "browser_download_url"]'
output_directory: 'data/github_releases_info'
cache_directory: '_cache_data/github_releases_info'
- name: Fetch GitHub Stargazers count
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: token ${GITHUB_TOKEN}" -s "https://api.github.com/repos/Warzone2100/warzone2100?page=1&per_page=100" | jq '.stargazers_count | {stargazers_count: .}' > "data/github_repo_info.json"
- name: Commit any changes to data files
env:
PUSH_PAT: ${{ secrets.WZ2100_PUSH_SECRET_TOKEN }} # use a PAT so that subsequent workflows are triggered on push
run: |
git config user.name "wzdev-ci"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u)
git commit -m "Automated data update: ${timestamp}" || exit 0
git push "https://${PUSH_PAT}@github.com/Warzone2100/wz2100.net.git" master:master