Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ runs:
run: |
touch .wp-env.json
> .wp-env.json
echo "{ \"core\": $WP_VERSION, \"port\": 8880, \"testsPort\": 8881, \"plugins\": [ \"https://downloads.wordpress.org/plugin/plugin-check.zip\" ], \"mappings\": { \"wp-content/plugins/$PLUGIN_SLUG\": \"$PLUGIN_DIR\" } }" >> .wp-env.json
echo "{ \"core\": $WP_VERSION, \"port\": 8880, \"testsPort\": 8881, \"mappings\": { \"wp-content/plugins/$PLUGIN_SLUG\": \"$PLUGIN_DIR\" } }" >> .wp-env.json

npm -g --no-fund i @wordpress/env
shell: bash
Expand All @@ -124,7 +124,9 @@ runs:
timeout_minutes: 10
max_attempts: 3
shell: bash
command: wp-env start --update
command: |
wp-env start --update
wp-env run cli wp cli info

- name: Run Plugin Check
run: |
Expand All @@ -146,6 +148,16 @@ runs:

ADDITIONAL_ARGS="$CHECKS $EXCLUDE_CHECKS $CATEGORIES $IGNORE_CODES $IGNORE_WARNINGS $IGNORE_ERRORS $INCLUDE_EXPERIMENTAL $EXCLUDE_FILES $EXCLUDE_DIRS $SEVERITY $ERROR_SEVERITY $WARNING_SEVERITY $INCLUDE_LOW_SEVERITY_ERRORS $INCLUDE_LOW_SEVERITY_WARNINGS $SLUG"

echo "::group::Install Plugin Check"

if wp-env run cli wp plugin is-installed plugin-check; then
wp-env run cli wp plugin activate plugin-check
else
wp-env run cli wp plugin install plugin-check --activate
fi

echo "::endgroup::"

echo "::group::Debugging information"
wp-env run cli wp cli info
wp-env run cli wp plugin list
Expand Down
18 changes: 18 additions & 0 deletions src/action.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { describe, it, expect } from 'vitest';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

const actionYml = readFileSync(join(__dirname, '..', 'action.yml'), 'utf8');

describe('action.yml', () => {
it('does not preload plugin-check from a download URL', () => {
expect(actionYml).not.toContain('plugin-check.zip');
expect(actionYml).toContain('wp plugin install plugin-check --activate');
});

it('verifies wp-env after starting it', () => {
expect(actionYml).toMatch(
/command:\s*\|\s*wp-env start --update\s+wp-env run cli wp cli info/,
);
});
});
Loading