handbook/.github/workflows/regenerate-handbook.yml
dependabot[bot] 25ba94128d
Bump actions/checkout from 6.0.3 to 7.0.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.3 to 7.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](df4cb1c069...9c091bb21b)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-19 01:43:05 +00:00

81 lines
2.5 KiB
YAML

name: Regenerate Handbook
on:
workflow_dispatch:
repository_dispatch:
types: [regenerate-handbook]
permissions:
contents: write
pull-requests: write
jobs:
regenerate:
name: Regenerate handbook
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up PHP environment
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: 'latest'
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Composer dependencies & cache dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4
- name: Install WP-CLI
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
sudo mv wp-cli-nightly.phar /usr/local/bin/wp
sudo chmod +x /usr/local/bin/wp
- name: Install non-bundled packages
run: bash bin/install_packages.sh
- name: Generate handbook
run: wp handbook gen-all
env:
WP_CLI_PACKAGES_DIR: bin/packages
WP_CLI_CONFIG_PATH: /dev/null
- name: Commit and Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
PR_BODY: |
**This is an automated pull-request**
Updates the built Markdown pages with the latest changes.
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b update-handbook
git add .
git commit -m "Regenerate handbook"
git push -f origin update-handbook
PR_NUMBER=$(gh pr list --head update-handbook --json number --jq '.[0].number // empty')
if [ -z "$PR_NUMBER" ]; then
gh pr create \
--title "Update handbook" \
--body "$PR_BODY" \
--label "scope:distribution" \
--base "${{ github.event.repository.default_branch }}" \
--head "update-handbook" \
--reviewer "swissspidy"
else
gh pr edit "$PR_NUMBER" \
--title "Update handbook" \
--body "$PR_BODY" \
--add-label "scope:distribution" \
--base "${{ github.event.repository.default_branch }}"
fi
fi