Skip to content

Commit

Permalink
feat: provide the commit information as output
Browse files Browse the repository at this point in the history
  • Loading branch information
Henkru committed Jul 21, 2024
1 parent b68767a commit 80b4051
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ inputs:
required: false
default: "."

outputs:
commit-url:
description: The URL of the created commit.
commit-hash:
description: The hash of the created commit.

runs:
using: "docker"
image: "Dockerfile"
Expand Down
7 changes: 6 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ ghcommit_args+=("${deletes[@]/#/--delete=}")

[[ -n "${DEBUG:-}" ]] && echo "ghcommit args: '${ghcommit_args[*]}'"

ghcommit "${ghcommit_args[@]}"
output=$(ghcommit "${ghcommit_args[@]}")

commit_url=$(echo "$output" | grep "Success. New commit:" | awk '{print $NF}')
commit_hash=$(echo "$commit_url" | awk -F '/' '{print $NF}')
echo "commit-url=$commit_url" >> "$GITHUB_OUTPUT"
echo "commit-hash=$commit_hash" >> "$GITHUB_OUTPUT"

0 comments on commit 80b4051

Please sign in to comment.