Skip to content

Commit

Permalink
Simplify and fix bundle size workflow (#894)
Browse files Browse the repository at this point in the history
Co-authored-by: Zack Krida <[email protected]>
  • Loading branch information
dhruvkb and zackkrida authored Mar 13, 2023
1 parent 6d601a3 commit 48ba7c5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .github/actions/get-changes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ outputs:
frontend:
description: "'true' if frontend changes are present"
value: ${{ steps.paths-filter.outputs.frontend }}
lint:
description: "'true' if linting setup changes are present"
value: ${{ steps.paths-filter.outputs.frontend }}

runs:
using: "composite"
Expand Down
6 changes: 6 additions & 0 deletions .github/filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ frontend:
- .pnpmfile.cjs
# Change to the CI + CD workflow should trigger complete workflow.
- .github/workflows/ci_cd.yml
lint:
- prettier.config.js
- .prettierignore
- .eslintrc.js
- .eslintignore
- .pre-commit-config.yaml
45 changes: 24 additions & 21 deletions .github/workflows/bundle_size.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
name: Compressed Size
name: Nuxt bundle size

on:
pull_request:
paths:
- "**.ts"
- "**.js"
- "**.vue"
- "**.css"
# Changes to any dependency
- "pnpm-lock.yaml"
# This file configures ESLint. Changes could affect the outcome.
- "**.eslint*"
# This file configures Prettier. Changes could affect the outcome.
- "**.prettier*"
# This file configures TypeScript. Changes could affect the outcome.
- "**.tsconfig*"
# This file configures Nuxt (and therefore the build). Changes could affect the outcome.
- "frontend/nuxt.config.ts"
# This file configures Tailwind and could affect the style outcome.
- "frontend/tailwind.config.js"
# Changes to this workflow file should always verify the changes are successful.
- ".github/workflows/bundle_size.yml"

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
Expand All @@ -30,10 +11,31 @@ concurrency:
cancel-in-progress: true

jobs:
get-changes:
name: Get changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
frontend: ${{ steps.paths-filter.outputs.frontend }}
lint: ${{ steps.paths-filter.outputs.lint }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get changes
id: paths-filter
uses: ./.github/actions/get-changes

build:
name: Check
runs-on: ubuntu-latest
if: github.repository == 'WordPress/openverse-frontend'
if: |
github.repository == 'WordPress/openverse' &&
(needs.get-changes.outputs.frontend == 'true' || needs.get-changes.outputs.lint == 'true')
needs:
- get-changes

steps:
- name: Checkout repository
Expand All @@ -44,6 +46,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
setup_python: false
install_recipe: node-install

- uses: preactjs/[email protected]
with:
Expand Down

0 comments on commit 48ba7c5

Please sign in to comment.