use gh cli to get affected files (#29823)
use gh client to get affected files
This commit is contained in:
parent
631dd573da
commit
aef1a4301c
|
@ -9,7 +9,13 @@ cd "$(dirname "$0")"/..
|
|||
output_file=${1:-/dev/stderr}
|
||||
|
||||
if [[ -n $CI_PULL_REQUEST ]]; then
|
||||
IFS=':' read -ra affected_files <<< "$(buildkite-agent meta-data get affected_files)"
|
||||
# filter pr number from ci branch.
|
||||
[[ $CI_BRANCH =~ pull/([0-9]+)/head ]]
|
||||
pr_number=${BASH_REMATCH[1]}
|
||||
echo "get affected files from PR: $pr_number"
|
||||
|
||||
# get affected files
|
||||
readarray -t affected_files < <(gh pr diff --name-only "$pr_number")
|
||||
if [[ ${#affected_files[*]} -eq 0 ]]; then
|
||||
echo "Unable to determine the files affected by this PR"
|
||||
exit 1
|
||||
|
|
|
@ -9,7 +9,13 @@ cd "$(dirname "$0")"/..
|
|||
output_file=${1:-/dev/stderr}
|
||||
|
||||
if [[ -n $CI_PULL_REQUEST ]]; then
|
||||
IFS=':' read -ra affected_files <<< "$(buildkite-agent meta-data get affected_files)"
|
||||
# filter pr number from ci branch.
|
||||
[[ $CI_BRANCH =~ pull/([0-9]+)/head ]]
|
||||
pr_number=${BASH_REMATCH[1]}
|
||||
echo "get affected files from PR: $pr_number"
|
||||
|
||||
# get affected files
|
||||
readarray -t affected_files < <(gh pr diff --name-only "$pr_number")
|
||||
if [[ ${#affected_files[*]} -eq 0 ]]; then
|
||||
echo "Unable to determine the files affected by this PR"
|
||||
exit 1
|
||||
|
|
|
@ -9,7 +9,13 @@ cd "$(dirname "$0")"/..
|
|||
output_file=${1:-/dev/stderr}
|
||||
|
||||
if [[ -n $CI_PULL_REQUEST ]]; then
|
||||
IFS=':' read -ra affected_files <<< "$(buildkite-agent meta-data get affected_files)"
|
||||
# filter pr number from ci branch.
|
||||
[[ $CI_BRANCH =~ pull/([0-9]+)/head ]]
|
||||
pr_number=${BASH_REMATCH[1]}
|
||||
echo "get affected files from PR: $pr_number"
|
||||
|
||||
# get affected files
|
||||
readarray -t affected_files < <(gh pr diff --name-only "$pr_number")
|
||||
if [[ ${#affected_files[*]} -eq 0 ]]; then
|
||||
echo "Unable to determine the files affected by this PR"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue