Skip to content

Commit

Permalink
Merge pull request #284 from Automattic/remove/support-level-label
Browse files Browse the repository at this point in the history
Remove support level label feature
  • Loading branch information
gudmdharalds authored Jul 6, 2022
2 parents 36cb4d9 + 74d3042 commit 1b2ee0b
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 731 deletions.
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,6 @@ For example:
{"post-generic-pr-support-comments":false}
```

### Support labels

`vip-go-ci` can put labels on pull requests indicating level of support provided. With this feature configured, `vip-go-ci` will attach a label to every new pull request that does not have it. For this to work, it will need access to a `repo-meta API` that needs to be available and `vip-go-ci` has to be configured to work with.

This feature can be used in the following way:

> ./vip-go-ci.php --set-support-level-label=true --set-support-level-field="support-level" --repo-meta-api-base-url="http://myrepometa-api.mycompany.is" --repo-meta-api-user-id=7334005 --repo-meta-api-access-token="MY-TOKEN"
Note that by default, all support level labels have a prefix: `[Support Level]`. This can be changed by using the `--set-support-level-label-prefix` option.

### IRC support

`vip-go-ci` supports posting certain logged messages to a HTTP API that will eventually relay the information to a IRC channel. This can of course be any IRC-like system, as long as the HTTP API behaves the same. This is useful if you need to have some information submitted to a monitoring system, for instance.
Expand Down Expand Up @@ -751,8 +741,8 @@ repo-meta-api-user-id= ; User ID for the meta API
repo-meta-api-access-token= ; Access token for the meta API
repo-owner= ; Repository owner for the test, should be found in meta API
repo-name= ; Repository name for the test
support-level= ; Name of support level given by meta API
support-level-field-name= ; Support level field name in meta API
support-level= ; Name of support level given by meta API (only used in tests)
support-level-field-name= ; Support level field name in meta API (only used in tests)
```

This file is not included, and needs to be configured manually.
Expand Down
67 changes: 0 additions & 67 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,6 @@ function vipgoci_help_print() :void {
"\t" . ' matches the criteria specified here.' . PHP_EOL .
"\t" . ' See README.md for usage.' . PHP_EOL .
PHP_EOL .
'Support level configuration:' . PHP_EOL .
"\t" . '--set-support-level-label=BOOL Whether to attach support level labels to pull requests.' . PHP_EOL .
"\t" . ' Will fetch information on support levels from repo-meta API.' . PHP_EOL .
"\t" . '--set-support-level-label-prefix=STRING Prefix to use for support level labels. Should be longer than five letters.' . PHP_EOL .
"\t" . '--set-support-level-field=STRING Field in responses from repo-meta API which we use to extract support level.' . PHP_EOL .
PHP_EOL .
'Repo meta API configuration:' . PHP_EOL .
"\t" . '--repo-meta-api-base-url=STRING Base URL to repo-meta API, containing support level and other' . PHP_EOL .
"\t" . ' information.' . PHP_EOL .
Expand Down Expand Up @@ -335,13 +329,6 @@ function vipgoci_options_recognized() :array {
'post-generic-pr-support-comments-branches:',
'post-generic-pr-support-comments-repo-meta-match:',

/*
* Support level configuration
*/
'set-support-level-label:',
'set-support-level-label-prefix:',
'set-support-level-field:',

/*
* Repo meta API configuration.
*/
Expand Down Expand Up @@ -1712,50 +1699,6 @@ function vipgoci_run_cleanup_irc( array &$options ) :void {
*/
}

/**
* Set support level label options.
*
* @param array $options Array of options.
*
* @return void
*/
function vipgoci_run_init_options_set_support_level_label(
array &$options
) :void {
/*
* Handle option for setting support
* labels. Handle prefix and field too.
*/

vipgoci_option_bool_handle(
$options,
'set-support-level-label',
'false'
);

if (
( isset( $options['set-support-level-label-prefix'] ) ) &&
( strlen( $options['set-support-level-label-prefix'] ) > 5 )
) {
$options['set-support-level-label-prefix'] = trim(
$options['set-support-level-label-prefix']
);
} else {
$options['set-support-level-label-prefix'] = null;
}

if (
( isset( $options['set-support-level-field'] ) ) &&
( strlen( $options['set-support-level-field'] ) > 1 )
) {
$options['set-support-level-field'] = trim(
$options['set-support-level-field']
);
} else {
$options['set-support-level-field'] = null;
}
}

/**
* Set repo-meta API options.
*
Expand Down Expand Up @@ -2145,9 +2088,6 @@ function vipgoci_run_init_options(
// Set options relating to generic PR support comments.
vipgoci_run_init_options_post_generic_pr_support_comments( $options );

// Set options relating to support level labels.
vipgoci_run_init_options_set_support_level_label( $options );

// Set options relating to the repo-meta API.
vipgoci_run_init_options_repo_meta_api( $options );

Expand Down Expand Up @@ -2770,13 +2710,6 @@ function vipgoci_run_scan(
$prs_implicated
);

/*
* Add support level label, if:
* - configured to do so
* - data is available in repo-meta API
*/
vipgoci_support_level_label_set( $options );

if ( true === $options['phpcs'] ) {
/*
* Verify that sniffs specified on command line
Expand Down
Loading

0 comments on commit 1b2ee0b

Please sign in to comment.