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

Implement Sidebar Checker workflow #2097

Merged
merged 18 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
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
27 changes: 27 additions & 0 deletions .github/workflows/check_sidebar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check missing sidebar links

on:
pull_request:
types:
- opened
- synchronize

jobs:
check-sidebar-links:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Make sidebar checker script executable
run: chmod +x _scripts/sidebar_checker/sidebar_checker.sh

- name: Run sidebar checker script
run: ./_scripts/sidebar_checker/sidebar_checker.sh

- name: Print missing documents file
run: if [ -f "_scripts/sidebar_checker/missing-documents.yml" ]; then cat _scripts/sidebar_checker/missing-documents.yml; else echo "No missing documents found."; fi

- name: Check for missing documents
run: test ! -s _scripts/sidebar_checker/missing-documents.yml
17 changes: 17 additions & 0 deletions _scripts/sidebar_checker/excludelist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Folders to exclude:
201811.0
201903.0
201907.0
202001.0
202005.0
202009.0
202108.0
202204.0
202212.0
202400.0
drafts-dev

# Documents to exclude:
docs/scos/user/overview-of-features/202204.0/overview-of-features.md
docs/scos/user/overview-of-features/202212.0/overview-of-features.md
index.md
47 changes: 47 additions & 0 deletions _scripts/sidebar_checker/run-sidebar-checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,50 @@ bash _scripts/sidebar_checker/sidebar_checker.sh
```

This prints a message in the terminal indicating which files are missing and generates the `missing-documents.yml` file with missing documents. The file is saved in the `_scripts/sidebar_checker` folder.


## Add folders and documents to the excludelist

If you need to exclude some documents or folders from the sidebar, you can add them to the `excludelist.yml` file.

To add a folder or document to the excludelist, in `_scripts/sidebar_checker/excludelist.yml`, list files and folders in respective sections.

The order of adding does not matter; however, for the sake of consistency, *add folders and files under respective sections*:

* For folders, use the `# Folders to exclude:` section.
* For documents, use `# Documents to exclude:`.

### Exclude a folder

Under `# Folders to exclude:`, add the name of the folder you want to exclude from Sidebar Checker.

For example, to exclude the `features` folder, add it at the end of the `# Folders to exclude:` section, under that last added folder, like this:

```yml
# Folders to exclude:
...
features
```

### Exclude a document

Under `# Documents to exclude:`, add the name of the document you want to exclude from Sidebar Checker.


* To exclude a *specific* document, add its relative file path like this:
```yml
# Documents to exclude:
...
docs/pbc/all/back-office/202212.0/install-the-spryker-core-back-office-feature.md
```

This excludes the `docs/pbc/all/back-office/202212.0/install-the-spryker-core-back-office-feature.md` document from the results of the Sidebar Checker run.

* To exclude *all* documents having the same name, add the file name at the end of the `# Documents to exclude:` section, like this:
```yml
# Documents to exclude:
...
index.md
```

This excludes all documents with the name `index.md` from the results of the Sidebar Checker run.
49 changes: 25 additions & 24 deletions _scripts/sidebar_checker/sidebar_checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ SIDEBARS=("_data/sidebars/acp_user_sidebar.yml" "_data/sidebars/cloud_dev_sideba
# Define sidebar titles
TITLES=("ACP User" "Cloud Dev" "Marketplace Dev" "Marketplace User" "PBC All" "SCOS Dev" "SCOS User" "SCU Dev" "SDK Dev")

# Define the folders to ignore
IGNORED_FOLDERS=("201811.0" "201903.0" "201907.0" "202001.0" "202005.0" "202009.0" "202108.0", "202204.0", "202212.0", "202400.0")

# Define output file path
OUTPUT_FILE="_scripts/sidebar_checker/missing-documents.yml"

# Read the exclusion list
EXCLUSIONS=($(cat _scripts/sidebar_checker/excludelist.yml))

# Remove existing output file if exists
rm -f "$OUTPUT_FILE"

Expand All @@ -24,27 +24,23 @@ for i in "${!SIDEBARS[@]}"; do
folder="${FOLDERS[$i]}"
sidebar_title="${TITLES[$i]}"

# Find missing files in folder; overview-of-features.md files are intenionally exluded from the sidebar; index.md files are skipped as these are used implicitly.
missing_files=($(find "$folder" -type f -name "*.md" \
-not -path "*/overview-of-features/202204.0/overview-of-features.md" \
-not -path "*/overview-of-features/202212.0/overview-of-features.md" \
-not -name "index.md" -not -path "*/\.*" -not -path "*/drafts-dev/*" -print0 | \
while IFS= read -r -d '' file_path; do
ignored=false
for dir in $(dirname "$file_path" | tr '/' ' '); do
if [[ "${IGNORED_FOLDERS[*]}" =~ "$dir" ]]; then
ignored=true
break
fi
done
if $ignored; then
continue
fi

if ! grep -q "^\s*url:\s.*$(basename "${file_path%.*}")" "$sidebar"; then
echo "$file_path"
fi
done))
# Find missing files in folder
missing_files=($(find "$folder" -type f -name "*.md" -print0 | \
while IFS= read -r -d '' file_path; do
excluded=false
for exclusion in "${EXCLUSIONS[@]}"; do
if [[ $(basename "$file_path") == "$exclusion" ]] || [[ "$file_path" =~ "$exclusion" ]]; then
excluded=true
break
fi
done
if $excluded; then
continue
fi
if ! grep -q "^\s*url:\s.*$(basename "${file_path%.*}")" "$sidebar"; then
echo "$file_path"
fi
done))

# Print missing files if any
if [[ ${#missing_files[@]} -gt 0 ]]; then
Expand All @@ -65,3 +61,8 @@ EOF
done
fi
done

# Fail the script if there are any missing documents
if [ -s "$OUTPUT_FILE" ]; then
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,23 @@
title: Product Information Management
description: The capability for managing product catalogs
template: concept-topic-template
last_udpated: Aug 16, 2023
---

The Product Information Management (PIM) capability lets you build a rich product catalog using flexible management tools.

The capability consists of a base shop and the marketplace addon. The base shop features are needed to run a regular shop, in which your company is the only entity fulfilling orders. The marketplace addon adds the marketplace product entity, which is product sold by a merchant. To run a marketplace, the features from both the base shop and the marketplace addon are required.
The capability consists of a base shop and the marketplace addon. The base shop features are needed to run a regular shop, in which your company is the only entity fulfilling orders. The marketplace addon adds the marketplace product entity, which is a product sold by a merchant. To run a marketplace, the features from both the base shop and the marketplace addon are required.

To learn more, see the following feature overviews:

* [Alternative Products](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/alternative-products-feature-overview.html)
* [Catalog](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/catalog-feature-overview.html)
* [Category Management](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/category-management-feature-overview.html)
* [Product Approval Process](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-approval-process-feature-overview.html)
* [Product Barcode](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-barcode-feature-overview.html)
* [Product Bundles](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-bundles-feature-overview.html)
* [Product](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-feature-overview/product-feature-overview.html)
* [Product Groups](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-groups-feature-overview.html)
* [Product Labels](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-labels-feature-overview.html)
* [Product Lists](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-lists-feature-overview.html)
* [Product Options](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-options-feature-overview.html)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@
title: Product Information Management
description: The capability for managing product catalogs
template: concept-topic-template
last_udpated: Aug 16, 2023
redirect_from:
- /docs/pbc/all/product-information-management/202212.0/base-shop/feature-overviews/pim-feature-overviews.html
---

The Product Information Management (PIM) capability lets you build a rich product catalog using flexible management tools.

The capability consists of a base shop and the marketplace addon. The base shop features are needed to run a regular shop, in which your company is the only entity fulfilling orders. The marketplace addon adds the marketplace product entity, which is product sold by a merchant. To run a marketplace, the features from both the base shop and the marketplace addon are required.
The capability consists of a base shop and the marketplace addon. The base shop features are needed to run a regular shop, in which your company is the only entity fulfilling orders. The marketplace addon adds the marketplace product entity, which is a product sold by a merchant. To run a marketplace, the features from both the base shop and the marketplace addon are required.

To learn more, see the following feature overviews:

* [Alternative Products](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/alternative-products-feature-overview.html)
* [Catalog](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/catalog-feature-overview.html)
* [Category Management](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/category-management-feature-overview.html)
* [Product Approval Process](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-approval-process-feature-overview.html)
* [Product Barcode](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-barcode-feature-overview.html)
* [Product Bundles](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-bundles-feature-overview.html)
* [Product](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-feature-overview/product-feature-overview.html)
* [Product Groups](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-groups-feature-overview.html)
* [Product Labels](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-labels-feature-overview.html)
* [Product Lists](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-lists-feature-overview.html)
* [Product Options](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-options-feature-overview.html)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,26 @@
title: Product Information Management
description: The capability for managing product catalogs
template: concept-topic-template
last_udpated: Aug 16, 2023
redirect_from:
- /docs/pbc/all/product-information-management/202212.0/base-shop/feature-overviews/pim-feature-overviews.html
- /docs/pbc/all/product-information-management/202307.0/base-shop/feature-overviews/pim-feature-overviews.html
---

The Product Information Management (PIM) capability lets you build a rich product catalog using flexible management tools.

The capability consists of a base shop and the marketplace addon. The base shop features are needed to run a regular shop, in which your company is the only entity fulfilling orders. The marketplace addon adds the marketplace product entity, which is product sold by a merchant. To run a marketplace, the features from both the base shop and the marketplace addon are required.
The capability consists of a base shop and the marketplace addon. The base shop features are needed to run a regular shop, in which your company is the only entity fulfilling orders. The marketplace addon adds the marketplace product entity, which is a product sold by a merchant. To run a marketplace, the features from both the base shop and the marketplace addon are required.

To learn more, see the following feature overviews:

* [Alternative Products](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/alternative-products-feature-overview.html)
* [Catalog](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/catalog-feature-overview.html)
* [Category Management](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/category-management-feature-overview.html)
* [Product Approval Process](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-approval-process-feature-overview.html)
* [Product Barcode](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-barcode-feature-overview.html)
* [Product Bundles](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-bundles-feature-overview.html)
* [Product](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-feature-overview/product-feature-overview.html)
* [Product Groups](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-groups-feature-overview.html)
* [Product Labels](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-labels-feature-overview.html)
* [Product Lists](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-lists-feature-overview.html)
* [Product Options](/docs/pbc/all/product-information-management/{{page.version}}/base-shop/feature-overviews/product-options-feature-overview.html)