Fix pom.xml conditions for workflows (#16758)
This commit is contained in:
parent
d81794123b
commit
ae189c5a34
2 changed files with 21 additions and 3 deletions
22
.github/actions/conditional/conditional.sh
vendored
22
.github/actions/conditional/conditional.sh
vendored
|
@ -44,10 +44,28 @@ for C in "${CONDITIONS[@]}"; do
|
||||||
PATTERN="${CONDITION[0]}"
|
PATTERN="${CONDITION[0]}"
|
||||||
|
|
||||||
# Convert pattern to regex
|
# 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
|
# 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
|
RUN_JOB=true
|
||||||
echo "* $REGEX"
|
echo "* $REGEX"
|
||||||
else
|
else
|
||||||
|
|
2
.github/actions/conditional/conditions
vendored
2
.github/actions/conditional/conditions
vendored
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
*/src/main/ ci operator
|
*/src/main/ ci operator
|
||||||
*/src/test/ ci operator
|
*/src/test/ ci operator
|
||||||
*/pom.xml ci operator
|
pom.xml ci operator
|
||||||
|
|
||||||
*.java codeql-java
|
*.java codeql-java
|
||||||
themes/ codeql-themes
|
themes/ codeql-themes
|
||||||
|
|
Loading…
Reference in a new issue