Skip to content

Generate Site Scaffolds #16

Generate Site Scaffolds

Generate Site Scaffolds #16

name: Generate Site Scaffolds
on:
workflow_dispatch:
inputs:
sites_data:
description: 'CSV data for sites. Use \n for line breaks. Format: YEAR,NAME,LOCATION,START_DATE,END_DATE\nYEAR,NAME,LOCATION,START_DATE,END_DATE'
required: true
type: string
jobs:
generate-scaffolds:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
sparse-checkout: |
/*
!assets/
!*/materials/
sparse-checkout-cone-mode: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pandas
- name: Create and process input CSV
run: |
echo -e "${{ github.event.inputs.sites_data }}" > sites.csv
echo "CSV contents:"
cat sites.csv
- name: Validate CSV format
run: |
if ! head -n 1 sites.csv | grep -q "YEAR,NAME,LOCATION,START_DATE,END_DATE"; then
echo "CSV header does not match expected format"
exit 1
fi
- name: Run scaffold generator
working-directory: ${{ github.workspace }}
run: |
echo "Working directory: $(pwd)"
ls -la
python .github/scripts/generate_site_scaffolds.py
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: 'Generate site scaffolds from CSV'
body: |
Automated PR to generate site scaffolds from provided CSV data.
Please review the generated files before merging.
branch: create-site-scaffolds
delete-branch: true
commit-message: 'Generate site scaffolds from CSV'