Skip to content

Commit

Permalink
feat: enable multiple api specs
Browse files Browse the repository at this point in the history
  • Loading branch information
evegufy committed Sep 24, 2024
1 parent 4f79811 commit fd4f68c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/publish_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ jobs:
path: docs
pattern: openapi-*
merge-multiple: true
- name: Move multiple OpenAPI specs files in one directory into individual directories
run: |
# Find all directories containing multiple *.yaml or *.yml files
find "$docs" -type d | while read -r DIR; do
# Count how many YAML/YML files are in the current directory
FILES=($(find "$DIR" -maxdepth 1 -type f \( -name "*.yaml" -o -name "*.yml" \)))
# If there are more than one YAML file in the directory
if [ ${#FILES[@]} -gt 1 ]; then
# Loop through each YAML file
for FILE in "${FILES[@]}"; do
# Extract the filename without the extension
FILENAME=$(basename "$FILE")
BASENAME="${FILENAME%.*}"
# Create a directory named after the file (without the extension)
TARGET_DIR="$DIR/$BASENAME"
mkdir -p "$TARGET_DIR"
# Move the file into the newly created directory
mv "$FILE" "$TARGET_DIR/"
done
fi
done
echo "Multiple OpenAPI specs files in one directory have been organized into individual directories."
- name: Create OpenAPI specs list
id: create_specs_list
run: |
Expand Down

0 comments on commit fd4f68c

Please sign in to comment.