addnab / docker-run-action

MIT License
209 stars 93 forks source link

How to specify volume mount? #28

Closed fatso83 closed 2 years ago

fatso83 commented 2 years ago

How would I mount the local directory as a volume? I would like to run this command using the GH action, but I see no option to mount volumes.

docker run --rm -v "$(pwd):/app" slashmo/swiftformat
tony commented 2 years ago

I'm in the same spot, it gives me:

docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
tony commented 2 years ago

@fatso83 Try this:

options: --rm -v ${{ github.workspace }}:/zap/wrk/:rw

In your case it would be: docker run --rm -v "${{ github.workspace }}:/app" slashmo/swiftformat

I found this via:

fatso83 commented 2 years ago

Perfect! Great to see it is mentioned, but it would be even better with an explicit text. Easy to miss a small -v in a wall of text 😄

fatso83 commented 2 years ago

Added a PR for this btw. Still waiting six weeks in