### Install WP Hooks Documentor Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md Install WP Hooks Documentor as a development dependency using npm. Ensure Node.js is installed. ```bash npm install --save-dev @10up/wp-hooks-documentor ``` -------------------------------- ### Action Hook Example Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md Example of a well-documented WordPress action hook. Use comprehensive PHPDoc blocks to describe parameters and their types for the documentation. ```php /** * Fires the action after a post is pushed via Distributor before remote request validation. * * @since 2.0.0 * * @param array|WP_Error $response The response from the remote request. * @param array $post_body The Post data formatted for the REST API endpoint. * @param string $type_url The Post type api endpoint. * @param int $post_id The Post id. * @param array $args The arguments passed into wp_insert_post. * @param WordPressExternalConnection $this The Distributor connection being pushed to. */ do_action( 'dt_push_external_post', $response, $post_body, $type_url, $post_id, $args, $this ); ``` -------------------------------- ### WP Hooks Documentor Workflow Source: https://context7.com/10up/actions-wordpress/llms.txt Generates WordPress plugin hook documentation using Docusaurus and deploys it to GitHub Pages. Requires Node.js and PHP environments. Installs npm dependencies and builds documentation. ```yaml # .github/workflows/build-docs.yml name: Build Hook Documentation on: push: branches: - trunk jobs: build-docs: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: 8.3 - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 - name: Install and Build Docs run: | npm install npm run build:docs - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: './docs/build' ``` -------------------------------- ### GitHub Actions Workflow for Building Docs (`build-docs.yml`) Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md This YAML file defines a GitHub Actions workflow to build WordPress hook documentation. It checks out the code, sets up PHP and Node.js, installs dependencies, builds the docs, and deploys them to GitHub Pages. ```yaml name: Build Hook Documentation on: push: branches: - trunk jobs: build-docs: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Setup proper PHP version uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0 with: php-version: 8.3 - name: Setup node uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0 with: node-version: 20 - name: npm install, and build docs run: | npm install npm run build:docs - name: Deploy to GH Pages uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: './docs/build' ``` -------------------------------- ### Filter Hook Example Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md Example of a well-documented WordPress filter hook. Ensure your hooks include detailed PHPDoc comments for accurate documentation generation. ```php /** * Filters the taxonomies that should be synced. * * @since 1.0.0 * * @param array $taxonomies Associative array list of taxonomies supported by current post in the format of `$taxonomy => $terms`. * @param WP_Post $post The post object. * * @return array Associative array list of taxonomies supported by current post in the format of `$taxonomy => $terms`. */ $taxonomies = apply_filters( 'dt_syncable_taxonomies', $taxonomies, $post ); ``` -------------------------------- ### ESLint Summary Report Workflow Source: https://context7.com/10up/actions-wordpress/llms.txt Converts ESLint JSON reports to markdown and outputs them to GitHub Actions job summaries. Includes steps for installing dependencies, generating the report, and annotating code. Runs on pull requests to the 'develop' branch. ```yaml # .github/workflows/eslint.yml name: ESLint on: pull_request: branches: - develop jobs: eslint: name: ESLint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install dependencies run: npm install - name: Generate linting report run: npm run lint:js -- --output-file eslint-report.json --format json continue-on-error: true - name: Annotate code linting results uses: ataylorme/eslint-annotate-action@v3 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' report-json: 'eslint-report.json' - name: Update summary run: | npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md cat eslint-report.md >> $GITHUB_STEP_SUMMARY if: ${{ failure() }} ``` -------------------------------- ### Pantheon WordPress Deploy Action Source: https://context7.com/10up/actions-wordpress/llms.txt Deploys WordPress sites to Pantheon hosting environments. Supports multidev environments and automatic promotion from Dev to Test. Requires Pantheon site name, machine token, and SSH private key secrets. ```yaml # .github/workflows/pantheon-deploy.yml name: Pantheon Deploy on: push: branches: - main - develop jobs: deploy: name: Deploy to Pantheon runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Deploy to Pantheon uses: 10up/pantheon-wp-deploy-action@stable with: pantheon_site_name: my-site pantheon_machine_token: ${{ secrets.PANTHEON_MACHINE_TOKEN }} ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} ``` -------------------------------- ### Deploy to WordPress.org Action Source: https://context7.com/10up/actions-wordpress/llms.txt Automatically deploys your WordPress plugin to the WordPress.org plugin repository when a new version is tagged on GitHub. Requires SVN username and password secrets. ```yaml # .github/workflows/deploy.yml name: Deploy to WordPress.org on: push: tags: - "*" jobs: deploy: name: Deploy to WordPress.org runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@stable env: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SLUG: my-plugin-slug ``` -------------------------------- ### package.json Scripts and DevDependencies Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md Configure npm scripts in your package.json for initializing and generating documentation. Includes the WP Hooks Documentor as a devDependency. ```json { ... "scripts": { ... "docs:init": "wp-hooks-documentor init", "docs:generate": "wp-hooks-documentor generate", }, "devDependencies": { "@10up/wp-hooks-documentor": "^1.0.1" } } ``` -------------------------------- ### Build Release Zip Action Source: https://context7.com/10up/actions-wordpress/llms.txt Builds a zip archive of your WordPress plugin and attaches it as an artifact. This allows testing the deployable package before release. Triggered on push to the 'develop' branch. ```yaml # .github/workflows/build-zip.yml name: Build Release Zip on: push: branches: - develop jobs: build: name: Build release zip runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Build plugin zip uses: 10up/action-wordpress-plugin-build-zip@stable - name: Upload artifact uses: actions/upload-artifact@v4 with: name: my-plugin path: ${{ github.event.repository.name }}.zip ``` -------------------------------- ### Dependency License Review Workflow Source: https://context7.com/10up/actions-wordpress/llms.txt Validates that project dependencies use GPL-compatible licenses, essential for WordPress plugins adhering to GPLv2. Configurable via a `.github/dependency-review-config.yml` file. Requires read permissions for contents and write for pull-requests. ```yaml # .github/workflows/dependency-review.yml name: Dependency Review on: pull_request: branches: - develop - trunk permissions: contents: read pull-requests: write jobs: dependency-review: name: Dependency Review runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Dependency Review uses: actions/dependency-review-action@v4 with: config-file: '.github/dependency-review-config.yml' fail-on-severity: critical license-check: true vulnerability-check: true ``` -------------------------------- ### WP Hooks Documentor Configuration (`wp-hooks-doc.json`) Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md This JSON file configures the WP Hooks Documentor. Specify project details, input and output paths, and files/hooks to ignore. ```json { "title": "Plugin Hooks Documentation", "tagline": "Hooks Documentation for the plugin", "url": "https://example.com", "baseUrl": "/", "repoUrl": "https://github.com/username/repo", "organizationName": "username", "projectName": "my-plugin", "input": ".", "ignoreFiles": [ "/tests/", "/vendor/", "/node_modules/" ], "ignoreHooks": [], "outputDir": "./docs", "templatesDir": "./wp-hooks-docs", "footerStyle": "dark", "footerCopyright": "Copyright © 2025 Your Name. Built with WP Hooks Documentor." } ``` -------------------------------- ### Generate PHPCS Report and Update Summary Source: https://github.com/10up/actions-wordpress/blob/stable/using-markdown-in-action-summary.md This workflow runs PHPCS, generates a JSON report, converts it to markdown using `phpcs-json-to-md`, and appends it to the step summary upon failure. It utilizes the `wpcs-action` for PHPCS checks. ```yaml jobs: phpcs: name: WPCS runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: WPCS check uses: 10up/wpcs-action@stable with: use_local_config: true extra_args: '--report-json=./phpcs-report.json' - name: Update summary run: | npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md cat phpcs-report.md >> $GITHUB_STEP_SUMMARY if: ${{ failure() }} ``` -------------------------------- ### WPCS Action (PHP Linting) Source: https://context7.com/10up/actions-wordpress/llms.txt Runs PHP_CodeSniffer against WordPress Coding Standards and displays warnings/errors as annotations in pull requests. Does not require PHPCS as a project dependency. Configuration includes enabling warnings and using local config. ```yaml # .github/workflows/phpcs.yml name: PHPCS Linting on: pull_request: branches: - develop - trunk jobs: phpcs: name: WPCS Check runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: WPCS check uses: 10up/wpcs-action@stable with: enable_warnings: true use_local_config: true extra_args: '--report-json=./phpcs-report.json' - name: Update summary run: | npx github:10up/phpcs-json-to-md --path ./phpcs-report.json --output ./phpcs-report.md cat phpcs-report.md >> $GITHUB_STEP_SUMMARY if: ${{ failure() }} ``` -------------------------------- ### Generate ESLint Report and Update Summary Source: https://github.com/10up/actions-wordpress/blob/stable/using-markdown-in-action-summary.md This workflow generates an ESLint JSON report, converts it to markdown, and appends it to the step summary if the linting fails. It uses `eslint-json-to-md` for conversion. ```yaml jobs: eslint: name: eslint runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: npm install run: npm install - name: Generate linting report run: npm run lint:js -- --output-file eslint-report.json --format json continue-on-error: true - name: Annotate code linting results uses: ataylorme/eslint-annotate-action@1.2.0 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' report-json: 'eslint-report.json' - name: Update summary run: | npm_config_yes=true npx github:10up/eslint-json-to-md --path ./eslint-report.json --output ./eslint-report.md cat eslint-report.md >> $GITHUB_STEP_SUMMARY if: ${{ failure() }} ``` -------------------------------- ### Repository Automator Action Workflow Source: https://context7.com/10up/actions-wordpress/llms.txt Automates repository operations such as PR validation, auto-labeling, issue assignment, review requests, milestone management, and conflict handling. Requires a GitHub token. ```yaml # .github/workflows/repo-automator.yml name: Repository Automation on: pull_request: types: [opened, edited, synchronize, reopened] issues: types: [opened, closed] jobs: automate: name: Run Automations runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Repository Automator uses: 10up/action-repo-automator@stable with: github_token: ${{ secrets.GITHUB_TOKEN }} validate_pr_description: true add_pr_labels: true auto_assign_issues: true auto_request_review: true reviewers: 'team-reviewers' add_milestone: true auto_label_merge_conflicts: true conflict_label: 'needs:rebase' ``` -------------------------------- ### Plugin Asset Update Action Source: https://context7.com/10up/actions-wordpress/llms.txt Deploys only asset and readme changes to the WordPress.org repository without creating a new release. Useful for updating screenshots or banners between releases. Triggered on push to the 'trunk' branch with changes in specific paths. ```yaml # .github/workflows/asset-update.yml name: Plugin Asset Update on: push: branches: - trunk paths: - '.wordpress-org/**' - 'readme.txt' jobs: asset-update: name: Update plugin assets runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: WordPress.org Asset Update uses: 10up/action-wordpress-plugin-asset-update@stable env: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SLUG: my-plugin-slug ``` -------------------------------- ### WordPress Security Scan Workflow Source: https://context7.com/10up/actions-wordpress/llms.txt Automates security checks for WordPress sites including syntax validation, virus scanning, and vulnerability detection using WPScan, Patchstack, or Wordfence Intelligence APIs. Requires a WPScan API token. ```yaml # .github/workflows/security-scan.yml name: WordPress Security Scan on: schedule: - cron: '0 0 * * 1' # Weekly on Monday workflow_dispatch: jobs: scan: name: Security Scan runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: WordPress Security Scan uses: 10up/wp-scanner-action@stable with: wpscan_api_token: ${{ secrets.WPSCAN_API_TOKEN }} check_vulnerabilities: true check_syntax: true paths: 'wp-content/plugins,wp-content/themes' ``` -------------------------------- ### Configure Close Stale Issues Workflow Source: https://context7.com/10up/actions-wordpress/llms.txt Set up a GitHub Actions workflow to automatically close stale issues after a specified period. This workflow runs daily and requires write permissions for issues. ```yaml name: Close Stale Issues on: schedule: - cron: '30 1 * * *' # Daily at 1:30am UTC permissions: issues: write jobs: stale: runs-on: ubuntu-latest steps: - uses: actions/stale@v9 with: days-before-stale: 7 days-before-close: 7 stale-issue-message: > It has been 7 days since more information was requested. This issue is now marked as stale and will be closed in 7 days if no response. close-issue-message: > This issue has been automatically closed due to no response. stale-issue-label: 'stale' close-issue-reason: 'not_planned' any-of-labels: 'needs:feedback' remove-stale-when-updated: true ``` -------------------------------- ### Ignoring Specific Hooks in Documentation Source: https://github.com/10up/actions-wordpress/blob/stable/wp-hooks-documentor-workflow.md To exclude certain hooks from being documented, add their names to the `ignoreHooks` array in your `wp-hooks-doc.json` configuration file. ```json { "ignoreHooks": [ "internal_hook_name", ] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.