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

Action doesn't work #19

Open
dannysauer opened this issue Aug 21, 2023 · 4 comments
Open

Action doesn't work #19

dannysauer opened this issue Aug 21, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@dannysauer
Copy link

The github action passes the filename in as a second argument, but then fails with:

error: Found argument './pr_body' which wasn't expected, or isn't valid in this context

USAGE:
    markdown-extract <pattern> <path> --no-print-matched-heading

For more information try --help
validate test plan

...assuming the filename is "./pr_body" I get the same failure without the leading ./, as well as with an absolute path.

After doing a little bit of research, the workspace in an action is mounted in the container under /github/workspace. So, it'd be nice if either the docs mentioned to prefix files with /github/workspace, or if the action Dockerfile set the workdir to /github/workspace and the docs said to use relative paths.

Or, probably ideally, maybe the binary detects that it's running as an action and does the path translation. Relative path = prefix /github/workspace, absolute path = substitue env $GITHUB_WORKDIR for /github/workspace or alert that the file must be located there if it's not. It's possible to use a different entrypoint in the action metadata. You can specify analternate entrypoint in the action.yml, so this logic could be encapsulated into a shell script which does the arg manipulation and then passes them along to the real program. It could even handle a /github/workspace prefix specially and leave that alone for backwards compatibility.

@dannysauer
Copy link
Author

Actually, I might have conflated two errors. One is that the path is all wonky. The other is that the argument is actually rejected. :D

@sean0x42 sean0x42 added the bug Something isn't working label Aug 21, 2023
@sean0x42
Copy link
Owner

Hey @dannysauer, thanks for raising! 🙌

I have actually not tested the GitHub action recently, so please let me know if you run into anything else whilst you're using markdown-extract :)

I am currently on vacation, away from my development environment. I'd be happy to take a good look when I'm back online in two weeks time, or if you are blocked and can't wait, I can review a PR for any essential fixes

Cheers

@dannysauer
Copy link
Author

...and looking closer, the docker run command github uses sets the workdir, so a relative path should just work to begin with. I'm getting an argument parsing error. I wonder if it's because the heading contains a space.

@skykooler
Copy link

I can confirm that the action also breaks for me if the heading contains a space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants