Fix pom.xml conditions for workflows (#16758)

This commit is contained in:
Stian Thorgersen 2023-02-01 08:57:41 +01:00 committed by GitHub
parent d81794123b
commit ae189c5a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -44,10 +44,28 @@ for C in "${CONDITIONS[@]}"; do
PATTERN="${CONDITION[0]}"
# Convert pattern to regex
REGEX=$(echo "$PATTERN" | sed 's|\.|[.]|g' | sed 's|/$|/.*|g' | sed 's|^*|.*|g')
REGEX="$PATTERN"
#REGEX=$(echo "$PATTERN" | sed 's|\.|\\.|g' | sed 's|/$|/.*|g' | sed 's|^*|.*|g')
# Escape '/' characters
REGEX=$(echo "$REGEX" | sed 's|\/|\\/|g')
# Escape '.' to make it match the '.' character only
REGEX=$(echo "$REGEX" | sed 's|\.|\\.|g')
# Convert '*' to match anything
REGEX=$(echo "$REGEX" | sed 's|\*|.*|g')
# If ends with directory seperator, allow anything within
REGEX=$(echo "$REGEX" | sed 's|/$|/.*|g')
# If no directory separators allow any directory structure before
if ( echo "$REGEX" | grep -v -E '\/' &>/dev/null ); then
REGEX="(.*\/)?$REGEX"
fi
# Check if changed files matches regex
if ( echo "$CHANGED_FILES" | grep -q "^$REGEX$"); then
if ( echo "$CHANGED_FILES" | grep -q -E "^$REGEX$"); then
RUN_JOB=true
echo "* $REGEX"
else

View File

@ -10,7 +10,7 @@
*/src/main/ ci operator
*/src/test/ ci operator
*/pom.xml ci operator
pom.xml ci operator
*.java codeql-java
themes/ codeql-themes