Update GitHub Skyline #296
This file contains hidden or 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 GitHub Actions workflow automatically updates 3D skyline STL files | |
| # representing GitHub activity (per year and overall) using the gh-skyline extension. | |
| # It runs daily via cron and commits any changes directly to the repository. | |
| name: Update GitHub Skyline | |
| on: | |
| # Daily at 05:00 UTC (e.g. 07:00 CET/CEST) | |
| schedule: | |
| - cron: '0 5 * * *' | |
| # Optional: Allow manual trigger from GitHub UI | |
| workflow_dispatch: | |
| jobs: | |
| update-skyline: | |
| name: Update Skyline | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout current repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| # Install the gh-skyline extension | |
| - name: Install gh-skyline extension | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh extension install github/gh-skyline | |
| # Generate the STL file for the current year | |
| - name: Generate current year STL | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_YEAR=$(date +%Y) | |
| gh skyline --user "komed3" --year "$CURRENT_YEAR" --output "$CURRENT_YEAR.stl" | |
| # Generate the full skyline STL (across all years) | |
| - name: Generate full skyline STL | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh skyline --user "komed3" --full --output "skyline.stl" | |
| # Generate the skyline STL (active years since 2020) | |
| - name: Generate active years skyline STL | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_YEAR=$(date +%Y) | |
| gh skyline --user "komed3" --year "2020-$CURRENT_YEAR" --output "print.stl" | |
| # Configure Git for commit | |
| - name: Configure Git user | |
| run: | | |
| git config user.name "komed3" | |
| git config user.email "webmaster@komed3.de" | |
| # Commit STL files (only if there are changes) | |
| - name: Commit updated STL files | |
| run: | | |
| git add *.stl | |
| git diff --cached --quiet || git commit -m "Update skyline STL files [auto]" | |
| # Push changes to the repo's main branch | |
| - name: Push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| run: | | |
| git push https://x-access-token:${PAT}@github.com/${{ github.repository }}.git HEAD:main |