Auto Update Stats Images #966
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 * * *" | |
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@v3 | |
# Run using Python 3.12 for consistency and aiohttp | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v4 | |
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 |