Giter VIP home page Giter VIP logo

pandoc-action-example's People

Contributors

alerque avatar carceneaux avatar kevinrohn avatar maxheld83 avatar mcaci avatar mikebell avatar pawamoy avatar sebastianzug avatar stmio avatar zeyu-li avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandoc-action-example's Issues

Error: pdflatex not found

I have the following GitHub work flow as a test and it fails, with the error pdflatex not found when invoked using act workflow_dispatch --container-architecture=linux/amd64.

name: Compile PDF

on: workflow_dispatch

jobs:
  compile_pdf:
    runs-on: ubuntu-latest
    steps:
      - name: Copy content from repository
        uses: actions/checkout@v3
      - name: Prepare files
        run: |
          mkdir -p output
      - name: Compile PDF
        uses: docker://pandoc/latex:latest
        with:
           args: --output=output/test.pdf README.md
      - name: Copy output
        uses: actions/upload-artifact@v3
        with:
          name: output
          path: output/test.pdf

The detailed error is:

docker run image=pandoc/latex:latest platform=linux/amd64 entrypoint=[] cmd=["--output=output/test.pdf" "README.md"]
| pdflatex not found. Please select a different --pdf-engine or install pdflatex

However, it runs totally fine if I invoke pandoc using Docker as:

docker run --platform "linux/amd64" --rm --volume "$(pwd):/data" --user $(id -u):$(id -g) pandoc/latex:latest README.md --output=output/test.pdf

I am baffled. Am I missing something pretty simple, or is this an issue with act?

Deprecated functionality in github action

This error just came up when running the Advanced Usage GH workflow during a PR:

Error: Unable to process command '::set-env name=FILELIST::"README.md" "lorem_1.md" "lorem_2.md" ' successfully.
Error: The set-env command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the ACTIONS_ALLOW_UNSECURE_COMMANDS environment variable to true. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

https://github.com/stephlocke/pandoc-action-example/runs/1491442419

openBinaryFile: does not exist (No such file or directory)

No matter what combination I try for my action, I get the error: openBinaryFile: does not exist (No such file or directory)

The action output looks like following:

/usr/bin/docker run --name pandoclatex_84d6e6 --label 7db2d7 --workdir /github/workspace --rm -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/Technical-procedures/Technical-procedures":"/github/workspace" pandoc/latex --output=blueye-technical-procedures.pdf Production/Payloads/ISS360/Instructions.md pandoc: Production/Payloads/ISS360/Instructions.md: openBinaryFile: does not exist (No such file or directory)

The repository has a folder structure: Production/Payloads/ISS360/Instructions.md. My hunch is that the repo is mapped to: -v "/home/runner/work/Technical-procedures/Technical-procedures":"/github/workspace", while the WORKDIR for the Docker Container is /data. But then I find it strange that the examples work and this is not mentioned in the READM.me?

Am I overlooking something obvious? I can run the docker run --rm -v "$(pwd):/data" pandoc/latex -o test.pdf Production/Payloads/ISS360/Instructions.md command locally just fine, and produce the pdf as expected (and here I map to /data).

Multiple outputs

Hi there,

I'm currently using Pandoc's docker in a Github action and it's working really well, thanks a lot for providing this opportunity!

I'm currently converting a single markdown file into latex using something like this :

- name: Pandoc
  uses: docker://pandoc/core:2.9
  with:
    args: >-
      -s -N
      -f markdown
      -t latex
      -o foo.tex
      foo.md

I would like to do this for multiple files, i. e. convert bar.md to bar.tex, baz.md to bar.tex and so forth and so on.

I tried the following but Github is complaining about the sequence...

- name: Pandoc
  uses: docker://pandoc/core:2.9
  with:
    args:
      - -s -N -f markdown -t latex -o foo.tex foo.md
      - -s -N -f markdown -t latex -o bar.tex bar.md

Any pointers on how I could do this would be greatly appreciated! Thanks a lot!

Add note about argument order

When running pandoc directly from the command line, the input file can be passed before, after, or between other options. For example, the following (from the User's Guide):

pandoc test.txt -o test.pdf

puts the input file first, followed by options.

However, my experience has been that when using the pandoc container in an action, and the pandoc executable is not passed as one of the arguments, the input file must be the last argument passed. Otherwise, something like this:

with:
  args: "docs/patient-guide.md -o output.pdf -t html"

fails with an error:

Syntax error: unexpected newline

It might be a good idea to document this.

obstacle replicating example "long usage"

Do difficulties I observe correlate with the red indicators "failing" on the landing page?

To familiarize myself with GitHub actions in general, and their use with pandoc in particular, I set up "Long Pandoc Calls" in a new GitHub repository in a path of .github/workflows/pandoc_long_call.yml. To account for developments on side of pandoc and ubuntu, the content however was edited a little and now reads as

name: Long Usage

on: push

jobs:
  convert_via_pandoc:
    runs-on: ubuntu-22.04
    steps:
      - run: echo "foo" > input.txt  # create an example file
      - uses: docker://pandoc/core:3.1
        with:
          args: >-  # allows you to break string into multiple lines
            --standalone
            --output=index.html
            input.txt

Contrasting to my anticipation, there however is no new (i.e. previously absent) file index.html written one could retrieve from the repository. I assumed input.txt would be a new file deposit in the top directory of the GitHub repository; this however equally doesn't show up.

Do you recommend a different syntax or/and an additional instruction to your example snippet to retain the new file as permanent record of index.html? If I want pandoc to convert some files within such a GitHub action, does args function as if pandoc were at the top level/root of the repository?

Add support for choosing working directory

I'm trying to implement an action to use pandoc on markdown files in my repository. The files are in subdirectories, e.g.,

. repo
  ├──seminar1
      ├──slides.md
  ├──seminar2
      ├── slides.md

I cannot figure out how to set the working directory for pandoc. Currently my action looks like this:

name: Make seminar slides from markdown

on: push
defaults:
  run:
    working-directory: seminar1

jobs:
  make_seminar1_slides:
    runs-on: ubuntu-18.04
    steps:
      - name: Get files
        uses: actions/checkout@v2
        with:
          ref: slides
          
      - name: Load pandoc
        uses: docker://pandoc/latex:2.9
        with:
          args: --from=gfm --to=beamer --resource-path=seminar1 --output=seminar1/slides.md.pdf seminar1/slides.md
          
      - name: Upload files
        uses: actions/upload-artifact@v2
        with:
          name: seminar-slides
          path: slides.md.pdf

Am I missing something? Is there a way to set a working directory for pandoc or in the action?

Cache the pulled Docker image with GHA?

First of all, thanks for creating these examples, they've been a Godsend for me! Much appreciated.

This may be beyond the scope of this project, but is there a way to cache the pulled docker images within a GitHub Action?

I am trying to cut down on the run-time of my github action, and everything is very fast, except the initial step of pulling the docker image - which takes ~55% of the total time. Ideally the first time it would take the full time, and then subsequently, it would use a cached Docker image.

Screen Shot 2022-02-19 at 10 18 03 PM

I have been trying to read up about this, and it sounds like there is some new functionality added that makes this possible, but my attempts to make it worked haven't yielded much fruit.

Some references

Adding this to my GHA should work, but I don't think I've got the placement quite right:

      - name: Cache Docker layers
        uses: actions/cache@v2
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-single-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-single-buildx

Let me know if I can provide any more information

Executable not found in $PATH

When using the docker action of pandoc the following error occurs:

      - run: |
          mkdir public
          echo "FILELIST=$(printf '"%s" ' src/sections/*.md)" >> $GITHUB_ENV
      - name: Build Report to HTML
        uses: docker://pandoc/latex:2.11.4
        with:
          args: >-
            pandoc
            --filter pandoc-xnos
            --metadata-file=src/metadata.yaml
            --citeproc
            --bibliography=src/bibliography.bib
            --toc
            --standalone
            --output=public/index.html
            ${{ env.FILELIST }}
←[34m[Publish GitHub Pages/build-gh-pages ] ←[0m  ❌  Failure - Build Report to HTML
Error: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "--filter": executable file not found in $PATH: unknown

The problem seems to be that the ENTRYPOINT is not set anymore?

(note that pandoc-xnos is installed via PIP)

How to run pandoc using a Windows runner?

Hi. I'm forced to use a Windows runner for a pipeline and the instructions in this repository do not work. Here's a MWE:

This pipeline fails, producing the error message Value cannot be null. (Parameter 'container').

jobs:
  build:
    runs-on: windows-latest
    steps:
      - uses: docker://pandoc/core
        with:
          args: "--help"

Changing to the ubuntu-latest runner fixes the problem. Any idea on why this is the case?

Install additional packages to the docker file

Hi maxheld83,
stupid question related to the included docker container. Is it possible to use the "standard" docker as shown in the examples but extend it by individually required packages? Or do I need to define a new container in this case?

More specifically, I used box drawing unicodes in my document. For this purpose `pmboxdraw.sty' needs to be installed. By the way, this package should be part of the texlive standard installation and I did not understand why it is not included.

Many thanks for your help!

Sebastian

Run pandoc command in a shell?

Would it be possible to call the pandoc command from a shell? I have a build script written in python that calls pandoc over some files through the subprocess module.

Typo in README

Chaps,

In the readme for the long example,

name: Long Usage

on: push

jobs:
  convert_via_pandoc:
    runs-on: ubuntu-18.04
    steps:
      - run: echo "foo" > input.txt  # create an example file
      - uses: docker://pandoc/core:2.9
        with:
          args: |>  # allows you to break string into multiple lines
            --standalone
            --output=index.html
            input.txt

I believe args: |> should be args: >-.

Error when using `macos-14`

When setting runs-on to macos-14 the build fails with the following error message:

Screenshot 2024-02-12 at 9 57 46 PM

I am not exactly sure what causes this issue but I suspect the INSTALLER_SUFFIX to be the culprit. As shown in the screenshot the specified suffix evaluates to macOS.pkg not the exact value of arm64-macOS.pkg as specified here. Note that when setting runs-on to ubuntu-latest the INSTALLER_SUFFIX evaluates to 1-amd64.deb.

A fix would be greatly appreciated.

Reference r-lib's action to setup pandoc

When Pandoc is used in a subprocess, one cannot simply use the examples given in the README.
Instead, one should install Pandoc and make it globally available on the system. The README does not currently show how to do that.

My suggestion is to reference this action, r-lib/setup-pandoc, in the README, or maybe develop something similar. The mentioned action seems to work on Linux, Mac OS and Windows in GHA.

feature suggestion, addition of a workflows to GitHub's interface

When setting up a new action, GitHub offers a couple of workflows ready for use. By search with keyword pandoc, there however is no example yet which would either

  • convert one light markup into an other, e.g. between orgmode/markdown and .tex
  • convert e.g. markdown to yield a pptx presentation
  • demonstrate the use of the second docker image to generate (via LaTeX as one pdf-engine) the conversion to yield a .pdf

I assume these example could booster the popularity of pandoc in general.

workflows

Missing package

Hi,

I'm trying to use this GH action but I'm currently running into the following issue:

Error producing PDF.
! LaTeX Error: File `tcolorbox.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 
         
l.141 \newtcolorbox

##[error]Docker run failed with exit code 43

The tcolorbox package is in texlive-latex-extra. I even tried to install this manually and I can verify this package is installed in my action:

- name: Install extra LaTeX packages
  run: sudo apt-get -y install texlive-latex-extra
- name: Show package
  run: apt-cache search tcolorbox | grep tex

Even when the package is installed in the system, I still get this error. Any ideas?

PS. Using pandoc/latex:2.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.