Skip to content

Another attempt

Another attempt #3

name: Generate README
on:
pull_request:
paths:
- "docs/*.md"
- "src/sim_recon/cli/parsing.py"
- "src/sim_recon/settings/formatting.py"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install (without dependencies)
python -m pip install . --no-deps

Check failure on line 23 in .github/workflows/generate_readme.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/generate_readme.yaml

Invalid workflow file

You have an error in your yaml syntax on line 23
- name: Get argparse help outputs
run: |
export OTF_HELP_OUTPUT=$(python -c "from sim_recon.cli.parsing import parse_otf_args; parse_otf_args(("--help",))")
export RECON_HELP_OUTPUT=$(python -c "from sim_recon.cli.parsing import parse_recon_args; parse_recon_args(("--help",))")
- name: Get sections
run: |
cd docs/
for file in sections/*; do
if [ -f "$file" ]; then
var_name="$(echo "${file^^}" | tr ./ _)"
echo "Saving $file to $var_name"
# Export file contents to an environment variable named from the path, e.g.:
# 'section/test_file.md' would be 'SECTION_TEST_FILE_MD'
export "${!var_name}"="$(<"$file")"
envsubst < "${!var_name}" # Substitute environment variables into each section (not other sections)
fi
done
- name: Fill template
run: |
cp -f docs/template.md README.md
envsubst < README.md