From 222c1ce82fad5071959550b2d56bdbbc462bcd23 Mon Sep 17 00:00:00 2001 From: Jan Papenbrock Date: Fri, 3 Jan 2025 11:56:31 +0100 Subject: [PATCH] refactor: Utilize scripting options of `git name-rev` to simplify command. --- basic/buildspec.yml | 2 +- buildspec.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basic/buildspec.yml b/basic/buildspec.yml index 57a838c67..42cb3faab 100644 --- a/basic/buildspec.yml +++ b/basic/buildspec.yml @@ -7,7 +7,7 @@ phases: commands: # Set COMMIT_INFO variables to send Git specifics to Cypress Cloud when recording # https://docs.cypress.io/guides/continuous-integration/introduction#Git-information - - export COMMIT_INFO_BRANCH="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g') | sed 's/~.\+$//g'" + - export COMMIT_INFO_BRANCH="$(git rev-parse HEAD | git name-rev --stdin --name-only | sed 's/remotes\/origin\///g') | sed 's/~.\+$//g'" - export COMMIT_INFO_MESSAGE="$(git log -1 --pretty=%B)" - export COMMIT_INFO_EMAIL="$(git log -1 --pretty=%ae)" - export COMMIT_INFO_AUTHOR="$(git log -1 --pretty=%an)" diff --git a/buildspec.yml b/buildspec.yml index 3a1f7626f..60e246fb6 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -28,7 +28,7 @@ phases: commands: # Set COMMIT_INFO variables to send Git specifics to Cypress Cloud when recording # https://docs.cypress.io/guides/continuous-integration/introduction#Git-information - - export COMMIT_INFO_BRANCH="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g') | sed 's/~.\+$//g'" + - export COMMIT_INFO_BRANCH="$(git rev-parse HEAD | git name-rev --stdin --name-only | sed 's/remotes\/origin\///g') | sed 's/~.\+$//g'" - export COMMIT_INFO_MESSAGE="$(git log -1 --pretty=%B)" - export COMMIT_INFO_EMAIL="$(git log -1 --pretty=%ae)" - export COMMIT_INFO_AUTHOR="$(git log -1 --pretty=%an)"