-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
61 lines (58 loc) · 2.24 KB
/
Copy pathaction.yml
File metadata and controls
61 lines (58 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Build pattern library
description: Generate a Markdown pattern library, with screenshots, from a WordPress site's registered block patterns.
inputs:
site-url:
description: Origin of the WordPress site to read patterns from, e.g. https://example.com
required: true
username:
description: WordPress user login holding the view_pattern_library capability.
required: true
app-password:
description: Application password for that user.
required: true
extra-headers:
description: >
Headers to send with every request to the site, one "Name: value" per line.
For origins behind an access proxy, e.g. a Cloudflare Access service token.
required: false
default: ''
output-path:
description: Directory to write the pattern library into. Overrides the config file.
required: false
default: ''
working-directory:
description: Directory containing pattern-library.config.js.
required: false
default: '.'
version:
description: Version of @humanmade/wp-pattern-library to run.
required: false
default: 'latest'
runs:
using: composite
steps:
# Playwright needs a browser. The official container image ships one, so skip
# the install when the workflow already runs in it.
- name: Install Chromium
shell: bash
run: |
if [ -z "${PLAYWRIGHT_BROWSERS_PATH:-}" ] && [ ! -d "$HOME/.cache/ms-playwright" ]; then
npx --yes playwright install --with-deps chromium
fi
- name: Build the pattern library
shell: bash
working-directory: ${{ inputs.working-directory }}
env:
PATTERN_LIBRARY_SITE: ${{ inputs.site-url }}
PATTERN_LIBRARY_WP_USER: ${{ inputs.username }}
PATTERN_LIBRARY_WP_APP_PASSWORD: ${{ inputs.app-password }}
# Passed through the environment, never interpolated into the script: these
# carry secrets, and a value with a newline or a quote in it would otherwise
# be run as shell.
PATTERN_LIBRARY_EXTRA_HEADERS: ${{ inputs.extra-headers }}
run: |
args=""
if [ -n "${{ inputs.output-path }}" ]; then
args="--output-dir=${{ inputs.output-path }}"
fi
npx --yes @humanmade/wp-pattern-library@${{ inputs.version }} build $args