Skip to content

Commit

Permalink
Merge pull request #806 from 10up/feature/plugin-check-action
Browse files Browse the repository at this point in the history
Add the WordPress Plugin Check Action
  • Loading branch information
dkotter authored Sep 27, 2024
2 parents 26e2a30 + 8171dfc commit b881574
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 5 deletions.
41 changes: 37 additions & 4 deletions .github/workflows/build-release-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,58 @@ name: Build release zip

on:
workflow_dispatch:
workflow_call:

jobs:
build_zip:
name: Build release zip
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set Node.js 16.x

- name: Setup node
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version-file: .nvmrc
- name: npm install and build

- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
id: cache-composer
uses: actions/cache@v4
env:
cache-name: cache-composer
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}

- name: Install node dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci --no-optional

- name: Install composer dependencies
run: composer install --no-dev -o

- name: Build
run: |
npm install
npm run build
npm run makepot
composer install --no-dev
npm run archive
- name: Upload the ZIP file as an artifact
uses: actions/upload-artifact@v4
with:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: WordPress Plugin Checks

on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop

jobs:
build:
uses: 10up/classifai/.github/workflows/build-release-zip.yml@develop

test:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download built zip
uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}

- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.event.repository.name }}

- name: Run plugin check
uses: wordpress/plugin-check-action@v1
with:
build-dir: ${{ github.event.repository.name }}
exclude-checks: 'plugin_readme,plugin_updater' # Plugin isn't on .org so excluding these for now.
exclude-directories: 'assets,dist,vendor'
4 changes: 3 additions & 1 deletion includes/Classifai/Providers/OpenAI/TextToSpeech.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function render_provider_fields(): void {
'' :
sprintf(
wp_kses(
/* translators: %s is replaced with the OpenAI Text to Speech models URL */
__( 'Select a <a href="%s" title="OpenAI Text to Speech models" target="_blank">model</a> depending on your requirement.', 'classifai' ),
[
'a' => [
Expand Down Expand Up @@ -120,7 +121,8 @@ public function render_provider_fields(): void {
'' :
sprintf(
wp_kses(
__( 'Select the speech <a href="%s" title="OpenAI Text to Speech models" target="_blank">voice</a>.', 'classifai' ),
/* translators: %s is replaced with the OpenAI Text to Speech voice options URL */
__( 'Select the speech <a href="%s" title="OpenAI Text to Speech voice options" target="_blank">voice</a>.', 'classifai' ),
[
'a' => [
'href' => [],
Expand Down

0 comments on commit b881574

Please sign in to comment.