Bot #12
Workflow file for this run
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 HTML | |
on: | |
pull_request: | |
paths: | |
- 'awesome_3dgs_papers.yaml' | |
push: | |
branches: [ main ] | |
paths: | |
- 'awesome_3dgs_papers.yaml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Generate HTML | |
run: | | |
python src/generate.py awesome_3dgs_papers.yaml index.html | |
- name: Create Update Branch and Commit Changes | |
run: | | |
# Configure git | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
# Create or update the branch | |
git checkout -B update-html | |
# Stage and commit changes | |
git add index.html | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
exit 0 | |
fi | |
# Commit and force push to update-html branch | |
git commit -m "Auto-generate index.html" | |
git push -f origin update-html | |
- name: Create Pull Request | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Check if PR already exists | |
pr_exists=$(gh pr list --head update-html --base main --json number --jq 'length') | |
if [ "$pr_exists" = "0" ]; then | |
# Create PR if it doesn't exist | |
gh pr create \ | |
--title "Update generated HTML" \ | |
--body "This is an automatically maintained PR that keeps the generated HTML in sync with YAML changes." \ | |
--base main \ | |
--head update-html || echo "Failed to create PR, may already exist" | |
else | |
echo "PR already exists, skipping creation" | |
fi |