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

Conditional removal of changelogs #4943

Merged
merged 6 commits into from
Sep 18, 2024
Merged
Changes from 5 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
28 changes: 27 additions & 1 deletion documentation/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
from pathlib import Path

Expand Down Expand Up @@ -43,7 +44,26 @@ def add_ext_to_path():

source_suffix = {".rst": "restructuredtext", ".md": "markdown"}

exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".venv", "README.md"]

# CI will be True if the CI environment variable is defined, otherwise False
CI = os.getenv("CI") is not None

# INCLUDE_CHANGELOGS will be True if the INCLUDE_CHANGELOGS environment variable is set to a truthy value.
# If INCLUDE_CHANGELOGS is not set, it will fall back to the value of CI.
INCLUDE_CHANGELOGS = bool(os.getenv("INCLUDE_CHANGELOGS", CI))

_default_exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".venv", "README.md"]

# If INCLUDE_CHANGELOGS is True, no additional patterns are excluded, so changelogs will be included.
# If INCLUDE_CHANGELOGS is False, "changelogs" will be added to the exclusion list.
exclude_patterns = _default_exclude_patterns + (
[] if INCLUDE_CHANGELOGS else ["changelogs"]
)

# Result: exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".venv", "README.md"]
# If INCLUDE_CHANGELOGS is False, the result will also include "changelogs".


suppress_warnings = [
# Pygments does not fully support language features we use
# in code blocks in the documentation. Unfortunately the best
Expand Down Expand Up @@ -116,4 +136,10 @@ def add_ext_to_path():
"packages/openverse_attribution/index": "/packages/python/openverse_attribution/index.html",
}

if "changelogs" in exclude_patterns:
# temporary placeholder for now
redirects["changelogs/"] = (
"/general/contribution/github_contribution_practices.html"
)

myst_enable_extensions = ["linkify"]