ci: automate README generation for CSES solutions #1
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 Docs | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
generate-readme: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [CSES] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install jinja2 | |
- name: Run script to generate README | |
run: | | |
python scripts/${{ matrix.platform }}/generate.py | |
- name: Commit and push changes | |
run: | | |
git config user.name 'GitHub Actions' | |
git config user.email 'actions@github.com' | |
git add solutions/${{ matrix.platform }} | |
git commit -m "docs(CSES): auto-generate ${{ matrix.platform }} README" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |