Skip to content

Create explore_education_statistics.yaml #36

Create explore_education_statistics.yaml

Create explore_education_statistics.yaml #36

name: Generate README
on:
pull_request:
types: [opened, synchronize]
paths:
- 'datasets/**/*.yml'
- 'datasets/**/*.yaml'
- 'README_template.md'
- 'scripts/*'
workflow_dispatch:
jobs:
generate-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }} # Checkout the PR branch
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Validate YAML files
run: python scripts/validate_yaml.py
- name: Generate README
run: python scripts/generate_readme.py
- name: Check for changes
id: changes
run: |
if git diff --quiet README.md; then
echo "No changes to README.md"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "Changes detected in README.md"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Stage README changes
if: steps.changes.outputs.has_changes == 'true'
run: |
git add README.md
- name: Create or Update Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs: update README for PR #${{ github.event.pull_request.number }}"
title: "docs: update README for PR #${{ github.event.pull_request.number }}"
body: |
This PR automatically updates the README.md based on dataset changes in #${{ github.event.pull_request.number }}.
Original PR: ${{ github.event.pull_request.html_url }}
This PR will be automatically updated if the original PR changes.
branch: readme-update-pr-${{ github.event.pull_request.number }}
base: ${{ github.event.pull_request.base.ref }}
delete-branch: true
labels: |
documentation
automated-pr