action-docs icon indicating copy to clipboard operation
action-docs copied to clipboard

fail (exit code) there is an error

Open jcook-uptycs opened this issue 2 years ago • 4 comments

I'm looking at using action-docs as a pre-commit hook. It would be kind of nice to have the tool fail (exit with non zero) if there is an issue.

For example there is no readme.

No files match the pattern: README.md

jcook-uptycs avatar Dec 30 '22 17:12 jcook-uptycs

Can you add some more details to reproduce your use case.

npalm avatar Mar 02 '23 15:03 npalm

@jcook-uptycs just curious if you have this working as pre-commit hook?

codezninja avatar Sep 23 '23 02:09 codezninja

curious if you have this working as pre-commit hook?

Kind of.

The pre-commit supplies {files} with a list of the action.yaml files. I calculate what the README.md should be. THen touch the file to make sure it is there. Then run action-docs

        for ACTION in {files}
        do
          echo "Action file found: ${ACTION}"
          ACTION_README=$(dirname "${ACTION}")/README.md
          touch "${ACTION_README}"
          pushd "$(dirname "${ACTION}")" || exit 1
          npx -y action-docs --update-readme --no-banner || exit 1
          popd || exit 1
        done

jcook-uptycs avatar Sep 25 '23 16:09 jcook-uptycs

@npalm

Can you add some more details to reproduce your use case.

It would be real helpful to have a command line option to give the path of an action.yaml (or multiple) and have action-docs run on the README in that path. It should create the README if needed.

jcook-uptycs avatar Sep 25 '23 16:09 jcook-uptycs