@@ -178,51 +178,43 @@ jobs:
178178 id : file-list
179179 if : steps.bump-type.outputs.skip != 'true'
180180 run : |
181+ # Process file patterns line by line
181182 BUMP_FILE_ARGS=""
182183
183- # Process each pattern from the input
184+ # Save the patterns to a variable first
185+ PATTERNS="${{ inputs.version_file_patterns }}"
186+
184187 echo "Processing file patterns from input"
185- echo "${{ inputs.version_file_patterns }}" | while IFS= read -r file_pattern || [ -n "$file_pattern" ]; do
186- # Skip empty lines and comments
187- if [ -z "$file_pattern" ] || [[ "$file_pattern" == \#* ]]; then
188+ # Use a for loop to process each pattern
189+ for file_pattern in $PATTERNS; do
190+ # Skip empty patterns
191+ if [ -z "$file_pattern" ]; then
188192 continue
189193 fi
190194
191- # Trim whitespace
192- file_pattern=$(echo "$file_pattern" | xargs)
193195 echo " - Processing pattern: $file_pattern"
194196
195- # Expand the glob pattern to actual files
196- matched_files=$(find . -path "./$file_pattern" 2>/dev/null || echo "")
197-
198- if [ -z "$matched_files" ]; then
199- # Check if it's a literal file that exists
200- if [ -f "$file_pattern" ]; then
201- echo " - Found literal file: $file_pattern"
202- BUMP_FILE_ARGS+=" --replace-in $file_pattern"
203- else
204- echo " - WARNING: No files matched pattern '$file_pattern' and file does not exist"
205- echo " - Skipping this pattern as bump cannot process non-existent files"
206- fi
197+ # Check if the file exists directly
198+ if [ -f "$file_pattern" ]; then
199+ echo " - Found file: $file_pattern"
200+ BUMP_FILE_ARGS="$BUMP_FILE_ARGS --replace-in $file_pattern"
207201 else
208- # Add each matched file individually after verifying it exists
209- while IFS= read -r file; do
210- if [ -n "$file" ]; then
211- # Remove leading ./ from the file path
212- relative_file="${file#./}"
213-
214- # Double-check the file exists (should always be true from find)
215- if [ -f "$relative_file" ]; then
216- echo " - Found file: $relative_file"
217- BUMP_FILE_ARGS+=" --replace-in $relative_file"
218- else
219- echo " - WARNING: File '$relative_file' was found by glob but doesn't exist - skipping"
220- fi
202+ # Check for glob matches
203+ for matched_file in $file_pattern; do
204+ if [ -f "$matched_file" ]; then
205+ echo " - Found file: $matched_file"
206+ BUMP_FILE_ARGS="$BUMP_FILE_ARGS --replace-in $matched_file"
221207 fi
222- done <<< "$matched_files"
208+ done
223209 fi
224210 done
225211
212+ # Add automatic detection for VERSION file
213+ if [ -f "VERSION" ]; then
214+ echo " - Found VERSION file"
215+ BUMP_FILE_ARGS="$BUMP_FILE_ARGS --replace-in VERSION"
216+ fi
217+
226218 echo "Bump file arguments: $BUMP_FILE_ARGS"
227219 echo "file_args=$BUMP_FILE_ARGS" >> $GITHUB_OUTPUT
228220
0 commit comments