openjournals / openjournals-draft-action

Experimental GitHub Action
MIT License
52 stars 12 forks source link

PandocLuaError "Cannot get Attr from TypeNil" #6

Closed Borda closed 2 years ago

Borda commented 2 years ago

Hello, I believe that #5 was implemented in 4a10348f3a5ed042fb12cd18c3d18ea246532848 and just after our paper builds start to fail, also checked with our master that using the listed action does not compile... Is this expected to happen?

Error running filter /usr/local/share/openjournals/data/filters/normalize-metadata.lua:
PandocLuaError "Cannot get Attr from TypeNil"
stack traceback:
    [C]: in function 'pandoc.utils.stringify'
    ...l/share/openjournals/data/filters/normalize-metadata.lua:32: in upvalue 'read_metadata'
    ...l/share/openjournals/data/filters/normalize-metadata.lua:41: in function 'Meta'

discovered while updating our JOSS draft in https://github.com/PyTorchLightning/metrics/pull/819

tarleb commented 2 years ago

This was caused by the switch to the new converter. I have reverted the change until we are sure that things work as expected.

Thank you for the report and apologies for the inconvenience.

Borda commented 2 years ago

just for the record, the revert was done in 2ea66a08ee0ff4bc4baa1cb442d81fde35faf447

agdturner commented 2 years ago

Hi,

I think I might be hitting the same issue. I get a Build Draft PDF fail. The full output is: Run openjournals/openjournals-draft-action@master with: journal: joss paper-path: paper.md /usr/bin/docker run --name openjournalsinaralatest_af3d73 --label 29a95e --workdir /github/workspace --rm -e INPUT_JOURNAL -e INPUT_PAPER-PATH -e GIT_SHA -e JOURNAL -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/ccg-v3d/ccg-v3d":"/github/workspace" openjournals/inara:latest "-o pdf" "paper.md" [INFO] Running filter /usr/local/share/openjournals/data/filters/inline-cited-references.lua [INFO] Loaded paper.bib from paper.bib [INFO] Completed filter /usr/local/share/openjournals/data/filters/inline-cited-references.lua in 8 ms [INFO] Loaded apa.csl from /usr/local/share/openjournals/apa.csl [INFO] Running filter /usr/local/share/openjournals/data/filters/add-images.lua [INFO] Loaded joss/aas-logo.png from /usr/local/share/openjournals/joss/aas-logo.png [INFO] Loaded joss/logo.png from /usr/local/share/openjournals/joss/logo.png [INFO] Completed filter /usr/local/share/openjournals/data/filters/add-images.lua in 4 ms [INFO] Running filter /usr/local/share/openjournals/data/filters/normalize-metadata.lua Error running filter /usr/local/share/openjournals/data/filters/normalize-metadata.lua: ...al/share/openjournals/data/filters/normalize/authors.lua:68: attempt to index a nil value (field 'name') stack traceback: ...l/share/openjournals/data/filters/normalize-metadata.lua:56: in function 'Meta'

Do you have any advice?

Thanks,

Andy

tarleb commented 2 years ago

This looks like an issue in Inara. I'm taking a look.

tarleb commented 2 years ago

@agdturner The issue is in the affiliations field. Please remove the dash before index, i.e., replace

affiliations:
 - name: CCG, School of Geography, University of Leeds
 - index: 1

with

affiliations:
 - name: CCG, School of Geography, University of Leeds
   index: 1
agdturner commented 2 years ago

Thanks @tarleb, but I made the change and things seem to have got a bit further, but I still get a Build Draft PDF fail with the output appearing as follows: Run openjournals/openjournals-draft-action@master /usr/bin/docker run --name openjournalsinaralatest_f54a97 --label 29a95e --workdir /github/workspace --rm -e INPUT_JOURNAL -e INPUT_PAPER-PATH -e GIT_SHA -e JOURNAL -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/ccg-v3d/ccg-v3d":"/github/workspace" openjournals/inara:latest "-o pdf" "paper.md" [INFO] Running filter /usr/local/share/openjournals/data/filters/inline-cited-references.lua [INFO] Loaded paper.bib from paper.bib [INFO] Completed filter /usr/local/share/openjournals/data/filters/inline-cited-references.lua in 10 ms [INFO] Loaded apa.csl from /usr/local/share/openjournals/apa.csl [INFO] Running filter /usr/local/share/openjournals/data/filters/add-images.lua [INFO] Loaded joss/aas-logo.png from /usr/local/share/openjournals/joss/aas-logo.png [INFO] Loaded joss/logo.png from /usr/local/share/openjournals/joss/logo.png [INFO] Completed filter /usr/local/share/openjournals/data/filters/add-images.lua in 5 ms [INFO] Running filter /usr/local/share/openjournals/data/filters/normalize-metadata.lua Error running filter /usr/local/share/openjournals/data/filters/normalize-metadata.lua: ...al/share/openjournals/data/filters/normalize/authors.lua:68: attempt to index a nil value (field 'name') stack traceback: ...l/share/openjournals/data/filters/normalize-metadata.lua:56: in function 'Meta'

Is there something else I must do?

tarleb commented 2 years ago

That's weird, and I'm not sure I understand: The builds at https://github.com/agdturner/ccg-v3d/actions appear to succeed now. Where and how do you run the action?

agdturner commented 2 years ago

I think I am running the action on GitHub infrastructure by selecting the workflow draft-pdf.yml and pressing Re-run all jobs. It is the Build draft PDF part that seems fails...

tarleb commented 2 years ago

OK, I see. This re-runs the job with the specific commit that was testes, not with the latest commit. There were no changes to the GitHub Action, so the job will continue to fail for that commit. Jobs running on the latest paper version succeed as expected: https://github.com/agdturner/ccg-v3d/actions/runs/1980248251

agdturner commented 2 years ago

Thank you for your help @tarleb. It seems it wasn't working they way I thought it would, but I am assuming all is fine. (I had expected the paper.pdf to appear in the repository, but it seems it gets deleted as part of the workflow which is no worries). All the best from Leeds in the UK :)

tarleb commented 2 years ago

The compiled PDF can be downloaded as an artifact from the workflow, e.g. here. I believe it would be possible to modify the workflow such that the PDF would be added to the repo; you'd need to amend the workflow steps with something along the lines of

- name: add paper.pdf
  run: git add paper.pdf
- name: commit changes
  run: git commit -m 'Update paper.pdf'
- name: push changes to repo
  run: git push origin

I didn't try it though, there may be unexpected things getting in the way. E.g., this could lead to an endless loop where the paper is recompiled repeatedly.