Skip to content

Commit 1c4df11

Browse files
authored
Revert "Add workflow to detect commands missing in readme (#213)" (#217)
1 parent 8e439f1 commit 1c4df11

1 file changed

Lines changed: 2 additions & 63 deletions

File tree

.github/workflows/reusable-regenerate-readme.yml

Lines changed: 2 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848

4949
- name: Configure git user
5050
run: |
51-
git config --global user.email "info@wp-cli.org"
52-
git config --global user.name "wp-make-coffee"
51+
git config --global user.email "alain.schlesser@gmail.com"
52+
git config --global user.name "Alain Schlesser"
5353
5454
- name: Check if remote branch exists
5555
id: check_remote_branch
@@ -74,67 +74,6 @@ jobs:
7474
sudo mv wp-cli-nightly.phar /usr/local/bin/wp
7575
sudo chmod +x /usr/local/bin/wp
7676
77-
- name: Check documented commands against registered commands
78-
if: steps.check_composer_file.outputs.files_exists == 'true'
79-
run: |
80-
TYPE=$(jq -r '.type' composer.json)
81-
if [ "$TYPE" != "wp-cli-package" ]; then
82-
echo "Not a wp-cli-package, skipping."
83-
exit 0
84-
fi
85-
86-
DOCUMENTED=$(jq -r '.extra.commands[]?' composer.json)
87-
if [ -z "$DOCUMENTED" ]; then
88-
echo "No extra.commands found in composer.json, skipping."
89-
exit 0
90-
fi
91-
92-
ROOTS=$(echo "$DOCUMENTED" | awk '{print $1}' | sort -u)
93-
94-
if ! DUMP=$(wp cli cmd-dump); then
95-
echo "::error::Failed to dump commands"
96-
exit 1
97-
fi
98-
99-
REGISTERED=$(echo "$DUMP" | jq -r '
100-
def walk_commands(prefix):
101-
(if prefix == "" then .name else prefix + " " + .name end) as $path |
102-
(if $path != "wp" and $path != "" then $path else empty end),
103-
(.subcommands[]? | walk_commands(if $path == "wp" or $path == "" then "" else $path end));
104-
walk_commands("")
105-
')
106-
107-
FOUND_ROOT=0
108-
while IFS= read -r root; do
109-
if echo "$REGISTERED" | grep -qE "^${root}( |$)"; then
110-
FOUND_ROOT=1
111-
break
112-
fi
113-
done <<< "$ROOTS"
114-
115-
if [ "$FOUND_ROOT" -eq 0 ]; then
116-
echo "::error::None of the documented root commands were found in the registered commands. Package commands may have failed to load."
117-
exit 1
118-
fi
119-
120-
MISSING=0
121-
while IFS= read -r cmd; do
122-
ROOT=$(echo "$cmd" | awk '{print $1}')
123-
if echo "$ROOTS" | grep -q "^$ROOT$"; then
124-
if ! echo "$DOCUMENTED" | grep -Fqx "$cmd"; then
125-
echo "::error::Missing command in composer.json: $cmd"
126-
MISSING=1
127-
fi
128-
fi
129-
done <<< "$REGISTERED"
130-
131-
if [ "$MISSING" -eq 1 ]; then
132-
echo "::error::Please update extra.commands in composer.json before regenerating README."
133-
exit 1
134-
fi
135-
136-
echo "All commands correctly documented."
137-
13877
- name: Regenerate README.md file
13978
run: |
14079
wp package install "wp-cli/scaffold-package-command:^2"

0 commit comments

Comments
 (0)