Skip to content

Commit

Permalink
Debugging from scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
EZoni committed Nov 19, 2024
1 parent f8d5036 commit a443348
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions .github/workflows/scripts/check_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -o nounset
set -o errexit
set -o pipefail
set -o xtrace

# Parse command line arguments
head_ref=${1}
Expand All @@ -13,11 +12,8 @@ clone_url=${3}
# Set paths to ignore
paths_ignore="^(Docs|\.github)/|\.azure-pipelines\.yml$"

# Check if remote repository already exists
if ! git remote --get-url fork > /dev/null 2>&1; then
# Add forked repository as remote
git remote add fork ${clone_url}
fi
# Add forked repository as remote
git remote add fork ${clone_url}

# Fetch base branch from main repository
git fetch origin ${base_ref}
Expand All @@ -28,17 +24,12 @@ git fetch fork ${head_ref}
# Save output of git diff to inspect files changed
git diff --name-only --diff-filter=ACMRTUXB origin/${base_ref}..fork/${head_ref} > check_diff.txt

# Check if check_diff.txt is not empty
if [ -s check_diff.txt ]; then
# Set skip variable after inspecting files changed
skip=$(grep -v -E "${paths_ignore}" check_diff.txt)
# Set an environment variable based on the output
if [ -z "$skip" ]; then
echo "SKIP_CHECKS=true" >> $GITHUB_ENV
else
echo "SKIP_CHECKS=false" >> $GITHUB_ENV
fi
else
# If check_diff.txt is empty, set SKIP_CHECKS to true
# Set skip variable after inspecting files changed
skip=$(grep -v -E "${paths_ignore}" check_diff.txt)

# Set an environment variable based on the output
if [ -z "$skip" ]; then
echo "SKIP_CHECKS=true" >> $GITHUB_ENV
else
echo "SKIP_CHECKS=false" >> $GITHUB_ENV
fi

0 comments on commit a443348

Please sign in to comment.