Skip to content

Commit

Permalink
fix(verify): Fetch the latest commit from the branches in question
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTatasciore committed Jan 7, 2022
1 parent 98eb205 commit b74ed2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/validate_changed_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ set -o errexit -o nounset -o pipefail
INVALID_FILE_PATHS=('pkg/plugin/sdk') # Array of filepaths that are not allowed
VALID_FILE_PATHS=('pkg/plugin/sdk/v1alpha2') # Array of filepaths that are allowed

git diff $1..$2 --name-only | while read -r file; do
# by default the only local branch will be pull/PR#/merge
# fetch only the latest commit from the 2 branches in question to avoid fetching the entire repo which could be costly
git fetch --depth 1 origin "$1"
git fetch --depth 1 origin "$2"

git diff "origin/$1..origin/$2" --name-only | while read -r file; do

# check if filepath matches a valid path. If so move to the next change
for valid_path in "${VALID_FILE_PATHS[@]}"; do
Expand Down

0 comments on commit b74ed2d

Please sign in to comment.