ci: use original commiter author instead of actor

pull/310/head
amrbashir 2 years ago
parent fa8e68fd6a
commit 148a457838
No known key found for this signature in database
GPG Key ID: BBD7A47A2003FF33

@ -36,11 +36,13 @@ elif [[ ! -d "$BUILD_BASE" ]]; then
exit 1
fi
COMMIT_ACTOR="${GITHUB_ACTOR} <${GITHUB_ACTOR}@users.noreply.github.com>"
COMMIT_AUTHOR=$(cd "${SOURCE_DIR:-.}" &&git show -s --format="%an <%ae>" $GITHUB_SHA)
if [[ -z "$COMMIT_MESSAGE" ]]; then
MONOREPO_COMMIT_MESSAGE=$(cd "${SOURCE_DIR:-.}" && git show -s --format=%B $GITHUB_SHA)
COMMIT_MESSAGE=$( printf "%s\n\nCommitted via a GitHub action: https://github.com/%s/actions/runs/%s\n" "$MONOREPO_COMMIT_MESSAGE" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" )
COMMIT_MESSAGE=$( printf "%s\n\nCommitted via a GitHub action: https://github.com/%s/actions/runs/%s\nCo-authored-by: %s\n" "$MONOREPO_COMMIT_MESSAGE" "$GITHUB_REPOSITORY" "$GITHUB_RUN_ID" "$COMMIT_ACTOR" )
fi
COMMIT_ORIGINAL_AUTHOR="${GITHUB_ACTOR} <${GITHUB_ACTOR}@users.noreply.github.com>"
if [[ "$GITHUB_REF" =~ ^refs/heads/ ]]; then
BRANCH=${GITHUB_REF#refs/heads/}
@ -98,7 +100,7 @@ while read -r PLUGIN_NAME; do
if [[ -n "$FORCE_COMMIT" || -n "$(git status --porcelain)" ]]; then
echo "Committing to $PLUGIN_NAME"
if git commit $FORCE_COMMIT --author="${COMMIT_ORIGINAL_AUTHOR}" -m "${COMMIT_MESSAGE}" &&
if git commit $FORCE_COMMIT --author="${COMMIT_AUTHOR}" -m "${COMMIT_MESSAGE}" &&
{ [[ -z "$CI" ]] || git push origin "$BRANCH"; } # Only do the actual push from the GitHub Action
then
# echo "$BUILD_BASE/changes.diff"

Loading…
Cancel
Save