Skip to content

Fetch GitHub Stars and Deploy Webpage with Jekyll #222

Fetch GitHub Stars and Deploy Webpage with Jekyll

Fetch GitHub Stars and Deploy Webpage with Jekyll #222

# 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.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@5fd5f8e2f88e735fc3d1151302b32242037e3962 # v1.8.0
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