diff --git a/action.yaml b/action.yaml index 14aa41c..36db19a 100644 --- a/action.yaml +++ b/action.yaml @@ -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" diff --git a/entrypoint.sh b/entrypoint.sh index 4d43fc2..9ce11c0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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"