generate git graph #555
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
name: generate git graph | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push events and only for the main branch | |
push: | |
branches: [main] | |
pull_request: | |
branches-ignore: [main] | |
schedule: | |
- cron: "5 7 * * */2" # every two days at 7:05am UTC | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
repository_dispatch: # run workflow on api request | |
# prevent concurrent jobs | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: clone remote repo | |
run: git clone https://codeberg.org/Starfish/TinyWeatherForecastGermany.git TinyWeatherForecastGermany | |
- name: clone this repo | |
run: git clone https://github.com/${{ github.repository }}.git "git-graph" | |
- name: update apt packages | |
run: timeout 120s sudo apt update || true | |
- name: upgrade apt packages | |
run: timeout 120s sudo apt upgrade -y || true | |
- name: Setup Python 3.x | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: install virtualenv | |
run: pip install virtualenv | |
- name: init virtualenv | |
run: virtualenv venv | |
- name: activate virtualenv | |
run: source venv/bin/activate | |
- name: upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: install graphviz | |
run: sudo apt install -y graphviz | |
- name: list directory contents | |
run: ls -lisha | |
- name: install pip dependencies | |
run: pip install -r git-graph/requirements.txt | |
- name: generate git graph using Python and graphviz | |
run: python git-graph/git_log2graphviz.py | |
- name: list directory contents | |
run: ls -lisha | |
- name: archive generated svg | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated-svg | |
path: | | |
*.svg | |
*.dot | |
- name: copy artifacts to git repo directory | |
run: | | |
cp *.svg git-graph/ || true | |
cp *.dot git-graph/ || true | |
- name: git commit and push | |
run: | | |
cd git-graph | |
git config --local user.name eUgEntOptIc44 | |
git config --local user.email [email protected] | |
git checkout --orphan pages | |
git reset | |
git add *.svg | |
git add *.dot || true | |
git add README.md || true | |
git commit -m "update git graph" | |
git remote add github-pages "https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" | |
git push -u -f github-pages |