I have multiple .md
files in several subdirectories of my repository. They all have the same naming convention, e.g. seminar1/slides.md
, seminar2/slides.md
, etc. These *.md
files need to be processed using pandoc. I would like to do this automatically every time I commit to the repository, and decided to implement this as an action that runs on Github.
I have created the following workflow as a .yml file, which GitHub recognises as an action. It works if I have a single subdirectory, e.g., /seminar1/*.md
, but fails with more subdirectories.
name: Make slides
on: push
jobs:
convert_via_pandoc:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
ref: slides
- run: |
echo "::set-env name=FILELIST::$(printf '"%s"' seminar*/*.md)"
- uses: docker://pandoc/latex:2.9
with:
args: -t beamer --output=${{env.FILELIST}}.pdf ${{env.FILELIST}}
- uses: actions/upload-artifact@v2
with:
name: seminar-slides
path: seminar*/*.md.pdf
How can I make a script detect all of the seminar*/*.md
files and act on them?
Also, I need some help with general usability:
- All of the scripts run from the root directory. This means I have to modify the content of the .md file to include the directory, e.g.
seminar1/bridge.jpg
rather than just includingbridge.jpg
. How can I change the working directory for each$env.FILELIST
? - How can I strip the extension from the filename and use this in
$env.FILELIST
?