docs: add ADR for attribute-scoped colour-scheme switching over light-dark() #2820
This file contains hidden or 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
| name: PR Title Check | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize] | |
| jobs: | |
| check-title: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check PR Title Format | |
| shell: bash | |
| run: | | |
| title="${{ github.event.pull_request.title }}" | |
| echo "π Checking PR title: '$title'" | |
| # Fail fast for spacing mistakes | |
| # Check for any space before ':' (covers both "type :" and "type(scope) :") | |
| if [[ "$title" =~ " :" ]]; then | |
| echo "β Invalid title: No space allowed before ':'" | |
| echo " Use: 'type: description' not 'type : description'" | |
| echo " Use: 'type(scope): description' not 'type(scope) : description'" | |
| exit 1 | |
| fi | |
| # Check for space before '(' (e.g. "feat (scope)") | |
| if [[ "$title" =~ ^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)[[:space:]] ]] && [[ "$title" =~ \( ]]; then | |
| echo "β Invalid title: No space allowed before '('" | |
| echo " Use: 'type(scope): description' not 'type (scope): description'" | |
| exit 1 | |
| fi | |
| # Require either "type: desc" or "type(scope): desc" | |
| re='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-zA-Z0-9][a-zA-Z0-9_-]*(,[a-zA-Z0-9][a-zA-Z0-9_-]*)*\))?(!)?: +[^ ].+$' | |
| if [[ "$title" =~ $re ]]; then | |
| echo "β Title matches Conventional Commits" | |
| else | |
| echo "β Invalid title: Must follow conventional commit format" | |
| echo " Default format (scope is optional and usually omitted):" | |
| echo " β’ type: description" | |
| echo " β’ type!: breaking change description" | |
| echo " With scope (only when needed β see AGENTS.md):" | |
| echo " β’ type(scope): description" | |
| echo " β’ type(scope)!: breaking change description" | |
| echo " Examples:" | |
| echo " β’ fix: resolve TextArea helper spacing" | |
| echo " β’ feat: add new component" | |
| echo " β’ chore(config): update release-please config" | |
| echo " β’ feat!: remove deprecated API" | |
| exit 1 | |
| fi | |
| # Optional: validate scope(s) if present | |
| if [[ "$title" =~ ^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\(([^\)]+)\) ]]; then | |
| scope_content="${BASH_REMATCH[2]}" | |
| echo "π¦ Scope detected: '$scope_content'" | |
| valid_scopes=("design-system-docs" "eds-color-palette-generator" "eds-core-react" "eds-data-grid-react" "eds-demo" "eds-icons" "eds-lab-react" "eds-tailwind" "eds-tokens" "eds-tokens-build" "eds-tokens-sync" "eds-utils" "figma-broker" "devcontainer" "github" "build" "deps" "config" "docs") | |
| IFS=',' read -ra scopes <<< "$scope_content" | |
| all_valid=true | |
| for scope in "${scopes[@]}"; do | |
| # no spaces are expected due to regex, but trim anyway | |
| scope="$(echo "$scope" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g')" | |
| found=false | |
| for vs in "${valid_scopes[@]}"; do [[ "$scope" == "$vs" ]] && found=true && break; done | |
| if ! $found; then echo " β Invalid scope: '$scope'"; all_valid=false; else echo " β $scope"; fi | |
| done | |
| if ! $all_valid; then | |
| echo "" | |
| echo "β Invalid scope(s): One or more scopes are not recognized" | |
| echo " Valid scopes:" | |
| printf " β’ %s\n" "${valid_scopes[@]}" | |
| echo " Use: 'type(valid-scope): description'" | |
| exit 1 | |
| fi | |
| else | |
| echo "π¦ No scope used (optional)" | |
| fi | |
| echo "β PR title OK" |