Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable multiple api specs for each product #21

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .github/workflows/publish_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,28 @@ jobs:
echo "RANDOM=${RANDOM}" >> $GITHUB_OUTPUT
cd ${{ env.API_COLLECTOR_DIR }}
go run main.go -owner ${{ github.repository_owner }} -token ${{ secrets.GITHUB_TOKEN }}
- name: Move multiple OpenAPI specs files in one directory into individual directories
run: |
# Find all directories containing multiple *.yaml or *.yml files
find "${{ env.API_COLLECTOR_DIR }}/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: Check for specs
id: check_specs
run: |
Expand Down Expand Up @@ -108,7 +130,7 @@ jobs:
- name: Generate Directory Listings
uses: jayanta525/[email protected]
with:
FOLDER: ${{ steps.determine_directory.outputs.PRODUCT_PATH }}
FOLDER: ${{ steps.determine_directory.outputs.DIR_PATH }}
- uses: actions/upload-artifact@v4
with:
name: swagger-${{ steps.determine_directory.outputs.RANDOM }}
Expand Down
Loading