Skip to content

Commit fcd0867

Browse files
Merge branch 'main' into improve/error-no-github-token
2 parents 516bc81 + 58bc7c0 commit fcd0867

15 files changed

+391
-277
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ updates:
77
open-pull-requests-limit: 10
88
labels:
99
- scope:distribution
10+
- package-ecosystem: github-actions
11+
directory: "/"
12+
schedule:
13+
interval: daily
14+
open-pull-requests-limit: 10
15+
labels:
16+
- scope:distribution
17+

.github/workflows/code-quality.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Check out source code
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v3
2424

2525
- name: Check existence of composer.json file
2626
id: check_composer_file
27-
uses: andstor/file-existence-action@v1
27+
uses: andstor/file-existence-action@v2
2828
with:
2929
files: "composer.json"
3030

@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Check existence of vendor/bin/parallel-lint file
4747
id: check_linter_file
48-
uses: andstor/file-existence-action@v1
48+
uses: andstor/file-existence-action@v2
4949
with:
5050
files: "vendor/bin/parallel-lint"
5151

@@ -59,11 +59,11 @@ jobs:
5959

6060
steps:
6161
- name: Check out source code
62-
uses: actions/checkout@v2
62+
uses: actions/checkout@v3
6363

6464
- name: Check existence of composer.json & phpcs.xml.dist files
6565
id: check_files
66-
uses: andstor/file-existence-action@v1
66+
uses: andstor/file-existence-action@v2
6767
with:
6868
files: "composer.json, phpcs.xml.dist"
6969

@@ -84,7 +84,7 @@ jobs:
8484

8585
- name: Check existence of vendor/bin/phpcs file
8686
id: check_phpcs_binary_file
87-
uses: andstor/file-existence-action@v1
87+
uses: andstor/file-existence-action@v2
8888
with:
8989
files: "vendor/bin/phpcs"
9090

.maintenance/clone-all-repositories.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@
1212
'wp-cli-roadmap',
1313
);
1414

15-
$request = 'https://api.github.com/orgs/wp-cli/repos?per_page=100';
16-
$headers = '';
17-
$token = getenv( 'GITHUB_TOKEN' );
18-
if (!empty($token)) {
19-
$headers = '--header "Authorization: token $token"';
20-
$response = shell_exec( "curl -s {$headers} {$request}" );
15+
$request = 'https://api.github.com/orgs/wp-cli/repos?per_page=100';
16+
$headers = '';
17+
$token = getenv( 'GITHUB_TOKEN' );
18+
if ( ! empty( $token ) ) {
19+
$headers = '--header "Authorization: token $token"';
20+
$response = shell_exec( "curl -s {$headers} {$request}" );
21+
} else {
22+
$response = shell_exec( "curl -s {$request}" );
2123
}
22-
else
23-
{
24-
$response = shell_exec( "curl -s {$request}" );
25-
}
26-
$repositories = json_decode( $response );
24+
$repositories = json_decode( $response );
2725
if ( ! is_array( $repositories ) && property_exists( $repositories, 'message' ) ) {
28-
echo "GitHub responded with: " . $repositories->message . "\n";
26+
echo 'GitHub responded with: ' . $repositories->message . "\n";
2927
echo "If you are running into a rate limiting issue during large events please set GITHUB_TOKEN environment variable.\n";
3028
exit( 1 );
3129
}
@@ -40,9 +38,10 @@
4038

4139
if ( ! is_dir( $repository->name ) ) {
4240
printf( "Fetching \033[32mwp-cli/{$repository->name}\033[0m...\n" );
43-
system( "git clone {$repository->ssh_url}" );
41+
$clone_url = getenv( 'GITHUB_ACTION' ) ? $repository->clone_url : $repository->ssh_url;
42+
system( "git clone {$clone_url}" );
4443
}
45-
44+
4645
$update_folders[] = $repository->name;
4746
}
4847

.maintenance/phpstorm.exclude-recursive-folders.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
2+
3+
// phpcs:disable PEAR.NamingConventions.ValidClassName.StartWithCapital,PEAR.NamingConventions.ValidClassName.Invalid
24
/**
35
* phpstorm follows symlinks when indexing, which creates an infinite loop of indexing.
46
* The inclusion of the vendor folders is mostly the problem
57
*/
6-
78
class phpstorm_exclude_recursive_folders {
89

910
public static function init() {
@@ -74,7 +75,7 @@ protected static function has_project_iml() {
7475
*/
7576
protected static function get_project_name() {
7677
$pwd = getcwd();
77-
$project_name = substr( $pwd, strrpos( $pwd, "/" ) + 1 );
78+
$project_name = substr( $pwd, strrpos( $pwd, '/' ) + 1 );
7879

7980
return $project_name;
8081
}
@@ -87,8 +88,8 @@ protected static function get_project_iml_path() {
8788
$modules_xml = new DOMDocument();
8889
$modules_xml->load( '.idea/modules.xml' );
8990
$iml_file_path = $modules_xml->getElementsByTagName( 'component' )->item( 0 )
90-
->getElementsByTagName( 'modules' )->item( 0 )
91-
->getElementsByTagName( 'module' )->item( 0 )->getAttribute( 'filepath' );
91+
->getElementsByTagName( 'modules' )->item( 0 )
92+
->getElementsByTagName( 'module' )->item( 0 )->getAttribute( 'filepath' );
9293
$iml_file_path = str_replace( '$PROJECT_DIR$/', '', $iml_file_path );
9394

9495
return $iml_file_path;
@@ -120,13 +121,15 @@ protected static function get_exclude_dir_list() {
120121
* Add the folders to exclude in the iml file.
121122
*/
122123
protected static function set_exclude_in_project_iml() {
123-
$folders_to_exclude = self::get_exclude_dir_list();
124-
$iml_xml = new DOMDocument();
124+
$folders_to_exclude = self::get_exclude_dir_list();
125+
$iml_xml = new DOMDocument();
126+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
125127
$iml_xml->preserveWhiteSpace = false;
126-
$iml_xml->formatOutput = true;
128+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
129+
$iml_xml->formatOutput = true;
127130
$iml_xml->load( self::get_project_iml_path() );
128131
$iml_xml_content_node = $iml_xml->getElementsByTagName( 'component' )->item( 0 )
129-
->getElementsByTagName( 'content' )->item( 0 );
132+
->getElementsByTagName( 'content' )->item( 0 );
130133
$xpath = new DomXpath( $iml_xml );
131134

132135
foreach ( $folders_to_exclude as $folder ) {
@@ -144,8 +147,10 @@ protected static function set_exclude_in_project_iml() {
144147
$iml_xml_content_node->appendChild( $exclude_node );
145148
}
146149

150+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
147151
$iml_xml->preserveWhiteSpace = false;
148-
$iml_xml->formatOutput = true;
152+
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
153+
$iml_xml->formatOutput = true;
149154
$iml_xml->save( self::get_project_iml_path() );
150155
}
151156
}

.maintenance/refresh-repository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
if ( ! isset ( $argv[1] ) || ! is_dir( $argv[1] ) ) {
3+
if ( ! isset( $argv[1] ) || ! is_dir( $argv[1] ) ) {
44
exit( "Usage: php refresh-repository.php <repository-folder>\n" );
55
}
66

77
$repository = $argv[1];
8-
$path = realpath( getcwd() . "/{$repository}" );
8+
$path = realpath( getcwd() . "/{$repository}" );
99

1010
printf( "--- Refreshing repository \033[32m{$repository}\033[0m ---\n" );
1111

0 commit comments

Comments
 (0)