Skip to content

CORE-982: Set page title for terms and privacy pages (#1642) #2316

CORE-982: Set page title for terms and privacy pages (#1642)

CORE-982: Set page title for terms and privacy pages (#1642) #2316

Workflow file for this run

name: Assets
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * 0' # weekly
# Add concurrency to cancel outdated workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
assets:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Cache node modules
uses: actions/cache@v4
with:
path: |
node_modules
vendor/bundle
.yarn-cache
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache compiled assets
uses: actions/cache@v4
with:
path: |
public/assets
public/accounts
key: assets-${{ github.sha }}
restore-keys: |
assets-
- name: Install dependencies
run: |
yarn install --frozen-lockfile
bundle install
- name: Build assets
env:
DISABLE_SES: true
RAILS_ENV: production
SECRET_KEY_BASE: fb1c1b629399c0ed18a89c3552955a7c378ce72a10a639df910631b702285149
run: bin/rake assets:precompile
- name: Verify assets
run: |
# List all directories in public for debugging
echo "📁 Public directory contents:"
ls -la public/
# Check for assets in standard location
if [ -d "public/assets" ]; then
echo "✅ Found assets in public/assets"
ASSETS_DIR="public/assets"
# Check for assets in accounts subdirectory
elif [ -d "public/accounts" ]; then
echo "✅ Found assets in public/accounts"
ASSETS_DIR="public/accounts"
else
echo "❌ No assets directory found in public/"
exit 1
fi
# List all compiled assets for debugging
echo "📦 Compiled assets in $ASSETS_DIR:"
find $ASSETS_DIR -type f -name "*.js" -o -name "*.css"
# Check for any JavaScript files
JS_FILES=$(find $ASSETS_DIR -type f -name "*.js" | wc -l)
if [ "$JS_FILES" -eq 0 ]; then
echo "❌ No JavaScript files found in $ASSETS_DIR"
exit 1
fi
# Check for any CSS files
CSS_FILES=$(find $ASSETS_DIR -type f -name "*.css" | wc -l)
if [ "$CSS_FILES" -eq 0 ]; then
echo "❌ No CSS files found in $ASSETS_DIR"
exit 1
fi
echo "✅ Asset verification passed"
- name: Upload compiled assets
if: always()
uses: actions/upload-artifact@v4
with:
name: compiled-assets
path: |
public/assets
public/accounts
retention-days: 7
- name: Check for unused assets
run: |
# Determine assets directory
if [ -d "public/assets" ]; then
ASSETS_DIR="public/assets"
elif [ -d "public/accounts" ]; then
ASSETS_DIR="public/accounts"
else
echo "No assets directory found, skipping unused asset check"
exit 0
fi
# Find potentially unused assets (files not referenced in the codebase)
find $ASSETS_DIR -type f -name "*.js" -o -name "*.css" | while read file; do
filename=$(basename "$file")
if ! grep -r --include="*.{js,css,erb,haml}" "$filename" app/ lib/ config/ > /dev/null; then
echo "Warning: $file might be unused"
fi
done