-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable multiple api specs (#21)
- add script to move multiple OpenAPI specs files in one directory into individual directories - change to directory path for listing of directories in index.html to enable directory listings also in those individual directories #20
- Loading branch information
Showing
1 changed file
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | | ||
|
@@ -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 }} | ||
|