[GH-ISSUE #907] Enhancement: Accept - (single hyphen) as a filename meaning "stdin" #538

Closed
opened 2026-03-01 21:44:17 +03:00 by kerem · 4 comments
Owner

Originally created by @rmunn on GitHub (Nov 27, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/907

Describe feature

By Unix convention, if a tool accepts a filename as input, the filename - (a single hyphen) will be interpreted as "read from stdin" so that the tool can be used in a pipe. I just tried to do that with act, and it thought that I was trying to read a file named - in the current directory.

Use case: I want to be able to create a template of an event file, then do something like this:

cat event-template.json | sed -e "s/SHA_GOES_HERE/$(git rev-parse HEAD)/" | act --eventpath -

But because act doesn't use the "- means stdin" convention, I have to create and clean up a temporary file instead:

fname=$(mktemp)
cat event-template.json | sed -e "s/SHA_GOES_HERE/$(git rev-parse HEAD)/" > "$fname"
act --eventpath "$fname"
rm "$fname"

That's easy enough, but it's a little bit of added complexity that wouldn't be needed if I could say --eventpath - and have act read the event from stdin.

Note that there are other options, like --secret-file and --env-file, that could also benefit from the "- means stdin" convention. --eventpath shouldn't be different from other options that take filenames: either all of them should accept - for stdin or none of them should.

Originally created by @rmunn on GitHub (Nov 27, 2021). Original GitHub issue: https://github.com/nektos/act/issues/907 ## Describe feature By Unix convention, if a tool accepts a filename as input, the filename `-` (a single hyphen) will be interpreted as "read from stdin" so that the tool can be used in a pipe. I just tried to do that with `act`, and it thought that I was trying to read a file named `-` in the current directory. Use case: I want to be able to create a template of an event file, then do something like this: ```bash cat event-template.json | sed -e "s/SHA_GOES_HERE/$(git rev-parse HEAD)/" | act --eventpath - ``` But because `act` doesn't use the "`-` means stdin" convention, I have to create and clean up a temporary file instead: ```bash fname=$(mktemp) cat event-template.json | sed -e "s/SHA_GOES_HERE/$(git rev-parse HEAD)/" > "$fname" act --eventpath "$fname" rm "$fname" ``` That's easy enough, but it's a little bit of added complexity that wouldn't be needed if I could say `--eventpath -` and have `act` read the event from stdin. Note that there are other options, like `--secret-file` and `--env-file`, that could also benefit from the "`-` means stdin" convention. `--eventpath` shouldn't be different from other options that take filenames: either all of them should accept `-` for stdin or none of them should.
kerem 2026-03-01 21:44:17 +03:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 28, 2021):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1001805518 --> @github-actions[bot] commented on GitHub (Dec 28, 2021): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@rmunn commented on GitHub (Dec 30, 2021):

Further activity to prevent issue being closed.

<!-- gh-comment-id:1002832896 --> @rmunn commented on GitHub (Dec 30, 2021): Further activity to prevent issue being closed.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 30, 2022):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1025011469 --> @github-actions[bot] commented on GitHub (Jan 30, 2022): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@rmunn commented on GitHub (Feb 14, 2022):

Please reopen.

<!-- gh-comment-id:1038915983 --> @rmunn commented on GitHub (Feb 14, 2022): Please reopen.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#538
No description provided.