Skip to content

refactor: minimal renaming and reorganizing for prompt_url #17

refactor: minimal renaming and reorganizing for prompt_url

refactor: minimal renaming and reorganizing for prompt_url #17

Workflow file for this run

name: Deploy Documentation
on:
push:
branches:
- main
paths:
- 'docs/**' # Documentation content
- 'mkdocs.yml' # MkDocs configuration
- '.github/workflows/docs.yml' # This workflow file
- 'pyproject.toml' # For doc dependencies
# Add any Python files that generate docs
- 'hf_hub_prompts/**/*.py' # Source files (for docstrings)
# Optional: Allow manual triggers
workflow_dispatch:
permissions:
contents: write
jobs:
check_changes:
runs-on: ubuntu-latest
outputs:
should_deploy: ${{ steps.check.outputs.should_deploy }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for checking changes
- name: Check for documentation changes
id: check
run: |
# Check if this is a manual trigger
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "should_deploy=true" >> $GITHUB_OUTPUT
exit 0
fi
# Check for changes in relevant files
git diff --name-only ${{ github.event.before }} ${{ github.event.after }} > changed_files.txt
# Look for changes in docs, mkdocs.yml, or Python files
if grep -q -E '^docs/|^mkdocs.yml|\.py$' changed_files.txt; then
echo "should_deploy=true" >> $GITHUB_OUTPUT
else
echo "should_deploy=false" >> $GITHUB_OUTPUT
fi
deploy:
needs: check_changes
if: needs.check_changes.outputs.should_deploy == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
key: poetry-${{ hashFiles('poetry.lock') }}
path: |
~/.cache/pypoetry
.venv
restore-keys: |
poetry-
- name: Install dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry install --only docs
- name: Build and deploy documentation
run: |
poetry run mkdocs gh-deploy --force