0

My Github action is calling my build.rb script which depends on the pandoc executable being available to the system (this is actually done by a dependency, so I can't change it).

I added pandoc to the Github action as per the instructions here https://github.com/pandoc/pandoc-action-example but my build.rb script is still erroring with sh: 1: pandoc: not found.

I think maybe I have to add the docker-compiled pandoc to the PATH so it can be used by my script, but I'm not sure how to do that.

This is the result from the uses: docker://pandoc/core:2.9 step:

Run docker://pandoc/core:2.9 /usr/bin/docker run --name pandoccore29_2dccd6 --label 372a9e --workdir /github/workspace --rm -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 GITHUB_STEP_SUMMARY -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/maxpleaner.github.io/maxpleaner.github.io":"/github/workspace" pandoc/core:2.9

Github action is shown below.

name: Ruby

on:
  push:
    branches: [ master ]

permissions:
  contents: read

jobs:
  build:
  
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: ['3.0']

    steps:
    - uses: actions/checkout@v3
      
      
    - name: Setup Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby-version }}
        bundler-cache: true # runs 'bundle install' and caches installed gems automatically
        
    - uses: docker://pandoc/core:2.9   
    - name: Build
      run: bundle exec ruby build.rb
      
    - name: Deploy
      uses: s0/git-publish-subdir-action@develop
      env:
          REPO: self
          BRANCH: gh-pages # The branch name where you want to push the assets
          FOLDER: dist # The directory where your assets are generated
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
          MESSAGE: "Build: ({sha}) {msg}" # The commit message
max pleaner
  • 26,189
  • 9
  • 66
  • 118
  • 3
    There's an action that will install pandoc and add it to the PATH, perhaps that's easier for you? https://github.com/nikeee/setup-pandoc – rethab Apr 04 '22 at 07:06
  • see also https://github.com/pandoc/dockerfiles#github-actions – mb21 Apr 05 '22 at 19:37
  • Thanks @mb21 I had checked that but it doesn't work for my case because I am using a library to do the pandoc commands, not running them myself. So I need it to be in PATH. Rethab, I haven't had time to try this because I've been on vacation but I will do so shortly, thanks so much. – max pleaner Apr 14 '22 at 13:32
  • Worked likd a charm @rethab! Feel free to make an answer if you want some reputation points – max pleaner Apr 20 '22 at 15:19

0 Answers0