Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Please review our contributing guidelines if you haven't recently: https://make.

Here's an overview to our process:

1. One of the project committers will soon provide a code review (https://make.wordpress.org/cli/handbook/code-review/).
1. One of the project committers will soon provide a code review.
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).
3. Please make sure to include functional tests for your changes.
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).
Expand Down
22 changes: 22 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Used by Probot Settings: https://probot.github.io/apps/settings/
repository:
description: Scaffolds WP-CLI commands with functional tests, full README.md, and more.
labels:
- name: scope:documentation
color: 0e8a16
- name: scope:testing
color: 5319e7
- name: good-first-issue
color: eb6420
- name: state:unconfirmed
color: bfe5bf
- name: state:unsupported
color: bfe5bf
- name: command:scaffold-package
color: c5def5
- name: command:scaffold-package-tests
color: c5def5
- name: command:scaffold-package-readme
color: c5def5
- name: command:scaffold-package-github
color: c5def5
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
wp-cli/scaffold-package-command
===============================

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

[![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)

Expand Down Expand Up @@ -258,6 +258,7 @@ files include:

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

**OPTIONS**

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-cli/scaffold-package-command",
"description": "Scaffold WP-CLI commands with functional tests",
"description": "Scaffolds WP-CLI commands with functional tests, full README.md, and more.",
"type": "wp-cli-package",
"homepage": "https://github.com/wp-cli/scaffold-package-command",
"support": {
Expand Down
42 changes: 42 additions & 0 deletions src/ScaffoldPackageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public function package_readme( $args, $assoc_args ) {
*
* * `.github/ISSUE_TEMPLATE` - Text displayed when a user opens a new issue.
* * `.github/PULL_REQUEST_TEMPLATE` - Text displayed when a user submits a pull request.
* * `.github/settings.yml` - Configuration file for the [Probot settings app](https://probot.github.io/apps/settings/).
*
* ## OPTIONS
*
Expand All @@ -427,9 +428,50 @@ public function package_github( $args, $assoc_args ) {
$force = Utils\get_flag_value( $assoc_args, 'force' );
$template_path = dirname( dirname( __FILE__ ) ) . '/templates';

$composer_obj = json_decode( file_get_contents( $package_dir . '/composer.json' ), true );
$settings_vars = array(
'has_description' => false,
'description' => '',
'has_labels' => true,
'labels' => array(
array(
'name' => 'scope:documentation',
'color' => '0e8a16'
),
array(
'name' => 'scope:testing',
'color' => '5319e7'
),
array(
'name' => 'good-first-issue',
'color' => 'eb6420',
),
array(
'name' => 'state:unconfirmed',
'color' => 'bfe5bf'
),
array(
'name' => 'state:unsupported',
'color' => 'bfe5bf'
),
),
);
if ( ! empty( $composer_obj['description'] ) ) {
$settings_vars['description'] = $composer_obj['description'];
$settings_vars['has_description'] = true;
}
if ( ! empty( $composer_obj['extra']['commands'] ) ) {
foreach ( $composer_obj['extra']['commands'] as $cmd ) {
$settings_vars['labels'][] = array(
'name' => 'command:' . str_replace( ' ', '-', $cmd ),
'color' => 'c5def5',
);
}
}
$create_files = array(
"{$package_dir}/.github/ISSUE_TEMPLATE" => Utils\mustache_render( "{$template_path}/github-issue-template.mustache" ),
"{$package_dir}/.github/PULL_REQUEST_TEMPLATE" => Utils\mustache_render( "{$template_path}/github-pull-request-template.mustache" ),
"{$package_dir}/.github/settings.yml" => Utils\mustache_render( "{$template_path}/github-settings.mustache", $settings_vars ),
);
$files_written = $this->create_files( $create_files, $force );
if ( empty( $files_written ) ) {
Expand Down
12 changes: 12 additions & 0 deletions templates/github-settings.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Used by Probot Settings: https://probot.github.io/apps/settings/
repository:
{{#has_description}}
description: {{description}}
{{/has_description}}
{{#has_labels}}
labels:
{{#labels}}
- name: {{name}}
color: {{color}}
{{/labels}}
{{/has_labels}}