WIP: Theme validation improvements #4
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
name: Theme Checklist for Dotorg repository | |
on: | |
pull_request: | |
types: | |
- labeled | |
- opened | |
- synchronize | |
- reopened | |
- unlabeled | |
jobs: | |
theme-check: | |
if: github.event.label.name == 'New Theme' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Determine Changed Themes | |
id: find-themes | |
run: | | |
CHANGED_THEMES=$(git diff --name-only ${{ github.event.pull_request.base.ref }}...${{ github.sha }} | awk -F/ '{print $1}' | uniq) | |
# Filter out non-theme directories (assuming each theme has a style.css file) | |
VALID_THEMES=() | |
for THEME in $CHANGED_THEMES; do | |
if [ -d "$THEME" ] && [ -f "$THEME/style.css" ]; then | |
VALID_THEMES+=("$THEME") | |
fi | |
done | |
# Expose as environment variable for next steps | |
echo "theme_slugs=$VALID_THEMES" >> $GITHUB_ENV | |
- name: Run Theme Checklist Script | |
run: npm run checklist -- "$theme_slugs" | |
env: | |
theme_slugs: ${{ env.theme_slugs }} |