Skip to content

Add GitHub Actions workflow for automated handbook generation#590

Merged
swissspidy merged 7 commits intomainfrom
copilot/add-github-actions-for-handbook
Dec 11, 2025
Merged

Add GitHub Actions workflow for automated handbook generation#590
swissspidy merged 7 commits intomainfrom
copilot/add-github-actions-for-handbook

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Adds automation to regenerate handbook documentation on-demand and from wp-cli/wp-cli releases.

Changes

Workflow (.github/workflows/regenerate-handbook.yml)

  • Manual trigger: workflow_dispatch for on-demand regeneration via Actions UI
  • External trigger: repository_dispatch with regenerate-handbook event type for wp-cli/wp-cli to trigger on releases
  • Installs WP-CLI nightly (using latest PHP version), non-bundled packages, runs wp handbook gen-all, commits/pushes changes

Documentation

  • Updated README.md with workflow usage and information on how to trigger the workflow from wp-cli/wp-cli

To trigger from wp-cli/wp-cli, use:

- name: Trigger handbook regeneration
  uses: peter-evans/repository-dispatch@v2
  with:
    token: ${{ secrets.HANDBOOK_TRIGGER_TOKEN }}
    repository: wp-cli/handbook
    event-type: regenerate-handbook

Requires PAT with repo scope added as HANDBOOK_TRIGGER_TOKEN secret in wp-cli/wp-cli.

Original prompt

This section details on the original issue you should resolve

<issue_title>Automate handbook generation</issue_title>
<issue_description>Would be nice if we could add a GitHub Actions workflow for this that could be triggered manually and even from the main framework repo. So whenever we release a new version, it would automatically trigger a handbook update.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 6, 2025 09:42
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Automate handbook generation with GitHub Actions Add GitHub Actions workflow for automated handbook generation Nov 6, 2025
Copilot AI requested a review from swissspidy November 6, 2025 09:47
@swissspidy
Copy link
Member

# Example: Triggering Handbook Regeneration from wp-cli/wp-cli

To trigger the handbook regeneration from the main wp-cli/wp-cli repository when releasing a new version, add the following step to your release workflow:

```yaml
- name: Trigger handbook regeneration
  uses: peter-evans/repository-dispatch@v2
  with:
    token: ${{ secrets.HANDBOOK_TRIGGER_TOKEN }}
    repository: wp-cli/handbook
    event-type: regenerate-handbook
```

## Setup Requirements

1. Create a GitHub Personal Access Token (PAT) with `repo` scope
2. Add the PAT as a secret named `HANDBOOK_TRIGGER_TOKEN` in the wp-cli/wp-cli repository settings
3. The token must have write access to the wp-cli/handbook repository

## Alternative: Using GITHUB_TOKEN

If you prefer to use the built-in `GITHUB_TOKEN`, you can use:

```yaml
- name: Trigger handbook regeneration
  run: |
    curl -X POST \
      -H "Accept: application/vnd.github.v3+json" \
      -H "Authorization: token ${{ secrets.HANDBOOK_TRIGGER_TOKEN }}" \
      https://api.github.com/repos/wp-cli/handbook/dispatches \
      -d '{"event_type":"regenerate-handbook"}'
```

This will send a repository dispatch event that triggers the "Regenerate Handbook" workflow in the handbook repository.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI requested a review from swissspidy November 6, 2025 13:24
@swissspidy swissspidy marked this pull request as ready for review November 6, 2025 20:45
@swissspidy swissspidy requested a review from a team as a code owner November 6, 2025 20:45
@swissspidy
Copy link
Member

@schlessera this should be helpful for the release, we can automate handbook regeneration after the release by triggering the workflow from the framework repo

@swissspidy swissspidy merged commit e180a42 into main Dec 11, 2025
12 of 13 checks passed
@swissspidy swissspidy deleted the copilot/add-github-actions-for-handbook branch December 11, 2025 18:30
swissspidy added a commit that referenced this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate handbook generation

2 participants

Comments