Skip to content

Fetch GitHub Stars and Deploy Webpage with Jekyll #356

Fetch GitHub Stars and Deploy Webpage with Jekyll

Fetch GitHub Stars and Deploy Webpage with Jekyll #356

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Fetch GitHub Stars and Deploy Webpage with Jekyll
on:
# Runs on a schedule (nightly)
schedule:
- cron: "0 0 * * *" # nightly at 00:00 UTC
push:
branches: ["develop"]
pull_request:
types: [opened, reopened, synchronize, closed]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
enable-cache: false
- name: Fetch GitHub stars
env:
GITHUB_TOKEN: ${{ github.token }}
run: ./scripts/fetch_stars.py
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697 # v1.0.13
- name: Deploy Preview (only for PRs)
if: github.event.pull_request.head.repo.full_name == github.repository
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1.8.1
with:
source-dir: ./_site/
- name: Deploy to GitHub Pages (only on develop branch)
if: github.ref == 'refs/heads/develop' && github.event.action != 'closed'
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
with:
folder: _site
clean-exclude: pr-preview/
force: false