Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix script to verify docs changes #20317

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/scripts/verify_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ if [[ "$event_type" == "pull_request" ]]; then
git fetch --no-tags --prune origin $head_ref
git fetch --no-tags --prune origin $base_ref
head_commit="origin/$head_ref"
prev_commit="origin/$base_ref"
base_commit="origin/$base_ref"
else
git fetch --no-tags --prune origin $ref_name
head_commit=$(git log origin/$ref_name --oneline | head -1 | awk '{print $1}')
prev_commit=$(git log origin/$ref_name --oneline | head -2 | awk 'NR==2 {print $1}')
base_commit=$(git log origin/$ref_name --oneline | head -2 | awk 'NR==2 {print $1}')
fi

change_count=$(git diff $head_commit..$prev_commit --name-only | awk -F"/" '{ print $1}' | uniq | wc -l)
# git diff with ... shows the differences count between base_commit and head_commit starting at the last common commit
change_count=$(git diff $base_commit...$head_commit --name-only | awk -F"/" '{ print $1}' | uniq | wc -l)

if [[ $change_count -eq 1 ]]; then
changed_dir=$(git diff $head_commit..$prev_commit --name-only | awk -F"/" '{ print $1}' | uniq)
changed_dir=$(git diff $base_commit...$head_commit --name-only | awk -F"/" '{ print $1}' | uniq)
fi

if [[ "$changed_dir" == "website" ]]; then
Expand Down