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 18, 2023
1 parent 49cb842 commit c780302
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
44 changes: 22 additions & 22 deletions .github/scripts/filter_changed_files_go_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@
# 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 main...$BRANCH)

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

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

# # 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 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" = "true" ]; then
trigger_ci=false
echo -e "$file_to_check\n"
echo "Only doc file(s) changed - triggered ci: $trigger_ci"
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT"
exit 0 ## if file is in list of the skipped_directory, exit script
fi
done

# echo "Only doc file(s) changed - triggered ci: $trigger_ci"
echo "Doc file(s) change detection is currently disabled - triggering ci"
echo -e "$files_to_check\n"
echo "Non doc file(s) changed - triggered ci: $trigger_ci"
echo "trigger-ci=$trigger_ci" >>"$GITHUB_OUTPUT"
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 c780302

Please sign in to comment.