Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Generate README.md

on:
pull_request:
paths:
- "markdown/README.md"
- "markdown/references.bib"
- "markdown/apa.csl"
- "update-readme.sh"
- ".github/workflows/update-readme.yml"
push:
branches: ["main"]
paths:
- "markdown/README.md"
- "markdown/references.bib"
- "markdown/apa.csl"
- "update-readme.sh"
- ".github/workflows/update-readme.yml"

permissions:
contents: read

jobs:
generate-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Pandoc
uses: pandoc/actions/setup@v1
with:
version: "3.1.13"

- name: Run README update script
run: bash update-readme.sh

- name: Check if README.md is up to date
run: |
if ! git diff --exit-code -- README.md; then
echo "README.md is out of date. Run update-readme.sh and re-commit the result."
git --no-pager diff -- README.md
exit 1
fi
2 changes: 2 additions & 0 deletions markdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ https://github.com/MantisFEM/Research.git`, or to check out a single publication
branch `name/of/publication` you can run `git clone --single-branch
--branch=name/of/publication https://github.com/MantisFEM/Research.git`.

Testing workflow.

# Publications

## Papers
Expand Down
20 changes: 20 additions & 0 deletions update_readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /usr/bin/env bash

# This script will update 'README.md' from 'markdown/README.md'.

# Check if 'pandoc' is installed and in 'PATH'.
if ! command -v pandoc >/dev/null 2>&1; then
echo "'pandoc' not found in 'PATH'. Please install or add to 'PATH'."
exit 1
fi

# Update README
pandoc markdown/README.md \
--from markdown+citations \
--to gfm \
--citeproc \
--wrap=none \
--csl=markdown/apa.csl \
--bibliography=markdown/references.bib \
--metadata=reference-section-title:References \
-o README.md
Loading