Skip to content

Commit e50da57

Browse files
authored
Merge pull request #154 from wp-cli/3857-scaffold-github-settings
Scaffold a `.github/settings.yml` with package description and labels
2 parents 5d7f641 + 2d24d6d commit e50da57

File tree

6 files changed

+80
-3
lines changed

6 files changed

+80
-3
lines changed

.github/PULL_REQUEST_TEMPLATE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Please review our contributing guidelines if you haven't recently: https://make.
66

77
Here's an overview to our process:
88

9-
1. One of the project committers will soon provide a code review (https://make.wordpress.org/cli/handbook/code-review/).
9+
1. One of the project committers will soon provide a code review.
1010
2. You are expected to address the code review comments in a timely manner (if we don't hear from you in two weeks, we'll consider your pull request abandoned).
1111
3. Please make sure to include functional tests for your changes.
1212
4. The reviewing committer will merge your pull request as soon as it passes code review (and provided it fits within the scope of the project).

.github/settings.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Used by Probot Settings: https://probot.github.io/apps/settings/
2+
repository:
3+
description: Scaffolds WP-CLI commands with functional tests, full README.md, and more.
4+
labels:
5+
- name: scope:documentation
6+
color: 0e8a16
7+
- name: scope:testing
8+
color: 5319e7
9+
- name: good-first-issue
10+
color: eb6420
11+
- name: state:unconfirmed
12+
color: bfe5bf
13+
- name: state:unsupported
14+
color: bfe5bf
15+
- name: command:scaffold-package
16+
color: c5def5
17+
- name: command:scaffold-package-tests
18+
color: c5def5
19+
- name: command:scaffold-package-readme
20+
color: c5def5
21+
- name: command:scaffold-package-github
22+
color: c5def5

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
wp-cli/scaffold-package-command
22
===============================
33

4-
Scaffold WP-CLI commands with functional tests
4+
Scaffolds WP-CLI commands with functional tests, full README.md, and more.
55

66
[![Build Status](https://travis-ci.org/wp-cli/scaffold-package-command.svg?branch=master)](https://travis-ci.org/wp-cli/scaffold-package-command) [![CircleCI](https://circleci.com/gh/wp-cli/scaffold-package-command/tree/master.svg?style=svg)](https://circleci.com/gh/wp-cli/scaffold-package-command/tree/master)
77

@@ -258,6 +258,7 @@ files include:
258258

259259
* `.github/ISSUE_TEMPLATE` - Text displayed when a user opens a new issue.
260260
* `.github/PULL_REQUEST_TEMPLATE` - Text displayed when a user submits a pull request.
261+
* `.github/settings.yml` - Configuration file for the [Probot settings app](https://probot.github.io/apps/settings/).
261262

262263
**OPTIONS**
263264

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-cli/scaffold-package-command",
3-
"description": "Scaffold WP-CLI commands with functional tests",
3+
"description": "Scaffolds WP-CLI commands with functional tests, full README.md, and more.",
44
"type": "wp-cli-package",
55
"homepage": "https://github.com/wp-cli/scaffold-package-command",
66
"support": {

src/ScaffoldPackageCommand.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ public function package_readme( $args, $assoc_args ) {
401401
*
402402
* * `.github/ISSUE_TEMPLATE` - Text displayed when a user opens a new issue.
403403
* * `.github/PULL_REQUEST_TEMPLATE` - Text displayed when a user submits a pull request.
404+
* * `.github/settings.yml` - Configuration file for the [Probot settings app](https://probot.github.io/apps/settings/).
404405
*
405406
* ## OPTIONS
406407
*
@@ -427,9 +428,50 @@ public function package_github( $args, $assoc_args ) {
427428
$force = Utils\get_flag_value( $assoc_args, 'force' );
428429
$template_path = dirname( dirname( __FILE__ ) ) . '/templates';
429430

431+
$composer_obj = json_decode( file_get_contents( $package_dir . '/composer.json' ), true );
432+
$settings_vars = array(
433+
'has_description' => false,
434+
'description' => '',
435+
'has_labels' => true,
436+
'labels' => array(
437+
array(
438+
'name' => 'scope:documentation',
439+
'color' => '0e8a16'
440+
),
441+
array(
442+
'name' => 'scope:testing',
443+
'color' => '5319e7'
444+
),
445+
array(
446+
'name' => 'good-first-issue',
447+
'color' => 'eb6420',
448+
),
449+
array(
450+
'name' => 'state:unconfirmed',
451+
'color' => 'bfe5bf'
452+
),
453+
array(
454+
'name' => 'state:unsupported',
455+
'color' => 'bfe5bf'
456+
),
457+
),
458+
);
459+
if ( ! empty( $composer_obj['description'] ) ) {
460+
$settings_vars['description'] = $composer_obj['description'];
461+
$settings_vars['has_description'] = true;
462+
}
463+
if ( ! empty( $composer_obj['extra']['commands'] ) ) {
464+
foreach ( $composer_obj['extra']['commands'] as $cmd ) {
465+
$settings_vars['labels'][] = array(
466+
'name' => 'command:' . str_replace( ' ', '-', $cmd ),
467+
'color' => 'c5def5',
468+
);
469+
}
470+
}
430471
$create_files = array(
431472
"{$package_dir}/.github/ISSUE_TEMPLATE" => Utils\mustache_render( "{$template_path}/github-issue-template.mustache" ),
432473
"{$package_dir}/.github/PULL_REQUEST_TEMPLATE" => Utils\mustache_render( "{$template_path}/github-pull-request-template.mustache" ),
474+
"{$package_dir}/.github/settings.yml" => Utils\mustache_render( "{$template_path}/github-settings.mustache", $settings_vars ),
433475
);
434476
$files_written = $this->create_files( $create_files, $force );
435477
if ( empty( $files_written ) ) {

templates/github-settings.mustache

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Used by Probot Settings: https://probot.github.io/apps/settings/
2+
repository:
3+
{{#has_description}}
4+
description: {{description}}
5+
{{/has_description}}
6+
{{#has_labels}}
7+
labels:
8+
{{#labels}}
9+
- name: {{name}}
10+
color: {{color}}
11+
{{/labels}}
12+
{{/has_labels}}

0 commit comments

Comments
 (0)