Skip to content

Commit

Permalink
Update base ref property name
Browse files Browse the repository at this point in the history
  • Loading branch information
NiniOak committed Sep 19, 2023
1 parent 07d916e commit 07ddc55
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
48 changes: 22 additions & 26 deletions .github/scripts/filter_changed_files_go_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,32 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

set -euo pipefail

# Get the list of changed files
files_to_check=$(git diff --name-only origin/$GITHUB_BASE_REF)
files_to_check=$(git diff --name-only "$(git merge-base origin/$BRANCH HEAD~)"...HEAD $*)

# Define the directories to check
skipped_directories=("docs/" "ui/" "website/" "grafana/")

# Initialize a variable to track directories outside the skipped ones
other_directories=""
trigger_ci=true
all_files_in_skipped_dirs=true
skip_ci=false

# # Loop through the changed files and find directories/files outside the skipped ones
# for file_to_check in $files_to_check; do
# file_is_skipped=false
# for dir in "${skipped_directories[@]}"; do
# if [[ "$file_to_check" == "$dir"* ]] || [[ "$file_to_check" == *.md && "$dir" == *"/" ]]; then
# file_is_skipped=true
# break
# fi
# done
# if [ "$file_is_skipped" = "false" ]; then
# other_directories+="$(dirname "$file_to_check")\n"
# trigger_ci=true
# echo "Non doc file(s) changed - triggered ci: $trigger_ci"
# echo -e $other_directories
# echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT"
# exit 0 ## if file is outside of the skipped_directory exit script
# fi
# done
# Loop through the files to check
for file in "${files_to_check[@]}"; do
file_directory="$(dirname "$file")"

# echo "Only doc file(s) changed - triggered ci: $trigger_ci"
echo "Doc file(s) change detection is currently disabled - triggering ci"
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT"
# Check if the file is not in the list of skipped directories
if [[ ! " ${skipped_directories[@]} " =~ " ${file_directory} " ]]; then
all_files_in_skipped_dirs=false
break
fi
done

if [ "$all_files_in_skipped_dirs" = true ]; then
skip_ci=true
echo "Only doc file(s) changed - skip-ci: $skip_ci"
echo "skip-ci=$skip_ci" >>"$GITHUB_OUTPUT"
else
echo "Non doc file(s) changed - skip-ci: $skip_ci"
echo "skip-ci=$skip_ci" >>"$GITHUB_OUTPUT"
fi
1 change: 1 addition & 0 deletions .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ permissions:
env:
TEST_RESULTS: /tmp/test-results
GOPRIVATE: github.com/hashicorp # Required for enterprise deps
BRANCH: ${{ github.head_ref || github.ref_name }}

# concurrency
concurrency:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
# strip the hashicorp/ off the front of github.repository for consul
CONSUL_LATEST_IMAGE_NAME: ${{ endsWith(github.repository, '-enterprise') && github.repository || 'hashicorp/consul' }}
GOPRIVATE: github.com/hashicorp # Required for enterprise deps
BRANCH: ${{ github.head_ref || github.ref_name }}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
Expand Down

0 comments on commit 07ddc55

Please sign in to comment.