Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obstacle replicating example "long usage" #27

Closed
nbehrnd opened this issue Apr 18, 2023 · 12 comments
Closed

obstacle replicating example "long usage" #27

nbehrnd opened this issue Apr 18, 2023 · 12 comments

Comments

@nbehrnd
Copy link

nbehrnd commented Apr 18, 2023

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?

@alerque
Copy link
Collaborator

alerque commented Apr 18, 2023

How are you testing whether index.html gets created or not?

@alerque
Copy link
Collaborator

alerque commented Apr 18, 2023

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

No, those were because we were calling deprecated Ubuntu base images. You code sample shows you are using a newer one already.

@tarleb
Copy link
Member

tarleb commented Apr 18, 2023

I think one of the issues are misaligned expectations: the action does not automatically add the created file to the repository. That would require additional work.

The action is just a computation that uses your repo as input. The resulting files can be made available as "artifacts", or added back into the repository with the help of other Actions. That's not what this action is designed to do though.

@nbehrnd
Copy link
Author

nbehrnd commented Apr 18, 2023

@alerque For me, the example "long usage" read like the syntax which could create an html, because the section

          args: >-  # allows you to break string into multiple lines
            --standalone
            --output=index.html
            input.txt

appears to me functional equivalent to running pandoc locally by pandoc --standalone --output=index.html input.txt. And on: push that it will run each time where is commit to the repository in question.

Hence I created again a pristine GitHub repository (public, it is here). At first, the actions are all marked as passing well, however I do not see neither the intermediate input.txt the early echo "foo" > input.txt claims to write, nor the eventual index.html. As either a) the creation is not successful, or b) perhaps the final
step cleaning data removes these for good when it comes to "Cleaning up orphan processes". Hence my speculation there were a crucial detail missing in the workflow used.

Side note: Below the example of "long usage" is the note "You can see it in action here", with here linking to http://github.com/maxheld83/pandoc-example which however resolves back to https://github.com/pandoc/pandoc-action-example.

test_again.zip

@nbehrnd
Copy link
Author

nbehrnd commented Apr 18, 2023

@tarleb While working, your reply enters the thread. Indeed, it does look like different anticipations when reading the same lines; perhaps especially because I only noticed yesterday (preparing a PR about pandoc's INSTALL.md) that pandoc could be used to keep e.g., documentation as .pdf file in sync with e.g., markdown as source by one / a set of multiple GitHub action(s).

Based on this misunderstanding I equally filed a suggestion to add e.g., a md2pdf conversion to the workflows "ready to use" GitHub suggests (here).

@nbehrnd
Copy link
Author

nbehrnd commented Apr 18, 2023

Because the description by @tarleb seem to match the example about advanced use, I gave this a spin. By the logs and green hooks, it worked. If I return to the landing page of the dummy project, it did not - no subfolder output, no .pdf, nor .md the yml file moderates to build even after waiting 15 min after completion of the run and multiple F5/refresh page in the Firefox web browser.

advanced.zip

@tarleb
Copy link
Member

tarleb commented Apr 18, 2023

The artifact is here: https://github.com/nbehrnd/pandoc_action_test/actions/runs/4736725999 (bottom of the page)

@alerque
Copy link
Collaborator

alerque commented Apr 18, 2023

As Albert notes this is working already, even for you.

The issue has nothing to do with "long" or "advanced" or "simple". The difference is that you added the uses: actions/upload-artifact@master action after the Pandoc action that takes the files generated inside the GitHub Action runner (which is a Docker container) and uploads it somewhere you can use.

There are such things as GH Actions that can commit back to the repository they were run from, but there are extra complications to consider when setting those up. Posting artifacts is the usual way to get something out that was created during a CI run like this.

@alerque alerque closed this as completed Apr 18, 2023
@tarleb
Copy link
Member

tarleb commented Apr 18, 2023

Minor addition: another common way to use actions is to publish the converted results to a website. I've blogged about that in the context of Quarto, which is built on pandoc. But using plain pandoc would work essentially the same.

@nbehrnd
Copy link
Author

nbehrnd commented Apr 19, 2023

@tarleb @alerque Affirmative, I now spot and can access the permanent record / pdf the example "Advanced Usage" generates. Note, GitHub equally informs to substitute "Node.js 12 actions" by "Node.js 16 actions" in summer 2023 and indicates a reference page : https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Thank you to you two for your assistance, the issue is resolved successfully.

2023-04-19T09 13 24 -- screenshots

@alerque
Copy link
Collaborator

alerque commented Apr 19, 2023

@nbehrnd That warning is not caused by this Pandoc action at all. Update your uses: actions/checkout@v2 to v3 to use the current version of the repository checkout action where that warning was coming from.

@nbehrnd
Copy link
Author

nbehrnd commented Apr 19, 2023

Except added leading comments about source and time stamp, and now the addition of something more Latin than "lorem ipsum", the yml used was a verbatim copy from the original as met [2023-04-18 Tue] 22:18 UTC+2. I give it a new spin.

Edit: it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants