Skip to content

Commit

Permalink
Fail the Github Actions step when the command errors (#21)
Browse files Browse the repository at this point in the history
With the `markdown-extract` command wrapped in a subshell, if it fails,
the entrypoint script itself doesn't produce an error. Instead, the
`Error: No matches.` output of the command (which SHOULD go to stderr,
not stdout) ends up in the `markdown` output and the entire action step
succeeds (when it SHOULD fail).
  • Loading branch information
zhimsel authored Oct 12, 2024
1 parent c693bde commit 2647122
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/action/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)

# process flags
Expand All @@ -15,4 +17,5 @@ if [ "$FLAG_NO_PRINT_MATCHED_HEADING" = "true" ]; then
fi
ARGUMENTS="$ARGUMENTS $*"

{ echo "markdown<<$EOF"; /markdown-extract $ARGUMENTS; echo "$EOF"; } >> "$GITHUB_OUTPUT"
/markdown-extract $ARGUMENTS 1>stdout
{ echo "markdown<<$EOF"; cat stdout; echo "$EOF"; } >> "$GITHUB_OUTPUT"

0 comments on commit 2647122

Please sign in to comment.