generated from jstrieb/github-stats
-
Notifications
You must be signed in to change notification settings - Fork 11
86 lines (73 loc) · 3.13 KB
/
auto_update_stat_images.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This is a scheduled workflow for daily automatic updates to the actions_branch branch
name: Auto Update Stats Images
# Controls when the action will run. Triggers the workflow on auto-scheduled push events
on:
schedule:
- cron: "30 0 * * 0"
workflow_dispatch:
permissions:
contents: write
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Sequence of tasks that will be executed as part of the job
steps:
# Checks-out repository under $GITHUB_WORKSPACE, so the job can access it
- name: Check out code
uses: actions/checkout@v4
# Run using Python 3.12 for consistency and aiohttp
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: 'x64'
cache: pip
cache-dependency-path: '**/requirements.txt'
# Switch to actions_branch if not exist, or create new actions_branch
- name: Switch to actions_branch
run: |
git fetch
git checkout actions_branch 3>/dev/null || git checkout -b actions_branch
git pull origin actions_branch
# Install dependencies with `pip`
- name: Install requirements
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -r requirements.txt
# Generate all statistics images
- name: Generate images
run: |
python3 --version
python3 git_stats_imgs.py
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXCLUDED: ${{ secrets.EXCLUDED }}
EXCLUDED_LANGS: ${{ secrets.EXCLUDED_LANGS }}
INCLUDE_FORKED_REPOS: ${{ secrets.INCLUDE_FORKED_REPOS }}
EXCLUDE_CONTRIB_REPOS: ${{ secrets.EXCLUDE_CONTRIB_REPOS }}
EXCLUDE_ARCHIVE_REPOS: ${{ secrets.EXCLUDE_ARCHIVE_REPOS }}
EXCLUDE_PRIVATE_REPOS: ${{ secrets.EXCLUDE_PRIVATE_REPOS }}
EXCLUDE_PUBLIC_REPOS: ${{ secrets.EXCLUDE_PUBLIC_REPOS }}
REPO_VIEWS: ${{ secrets.REPO_VIEWS }}
LAST_VIEWED: ${{ secrets.LAST_VIEWED }}
FIRST_VIEWED: ${{ secrets.FIRST_VIEWED }}
STORE_REPO_VIEWS: ${{ secrets.STORE_REPO_VIEWS }}
MORE_COLLABS: ${{ secrets.MORE_COLLABS }}
MORE_REPOS: ${{ secrets.MORE_REPOS }}
ONLY_INCLUDED: ${{ secrets.ONLY_INCLUDED }}
ONLY_INCLUDED_COLLAB_REPOS: ${{ secrets.ONLY_INCLUDED_COLLAB_REPOS }}
EXCLUDED_COLLAB_REPOS: ${{ secrets.EXCLUDED_COLLAB_REPOS }}
MORE_COLLAB_REPOS: ${{ secrets.MORE_COLLAB_REPOS }}
# Commits all changed files to the repository
- name: Commit to the repo
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
# "echo" returns true so the build succeeds, even if no changed files
git commit -m 'Auto Update GitHub stats images' || echo
git push origin actions_branch