Skip to content

Commit

Permalink
Accept comment threshold config at the top level
Browse files Browse the repository at this point in the history
Also, for clarity group configs for labelling and commenting under
top-level keys.
  • Loading branch information
lerebear committed Oct 10, 2023
1 parent c0163ba commit 593c1d7
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 176 deletions.
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,33 @@ This Action can be configured by specifying the `configuration-file` input. The
An example configuration file looks like this:

```yaml
# Whether or not to add a label to each pull request to indicate its assessed category
applyCategoryLabels: true
labeling:
# The prefix to add to each category label that we apply.
categoryLabelPrefix: "sizeup/"
# Whether or not to add a label to each pull request to indicate its assessed category
applyCategoryLabels: true
# Whether or not to add a comment to each assessed pull request that exceeds
# the recommended score threshold
addCommentWhenScoreThresholdHasBeenExceeded: true
# The prefix to add to each category label that we apply.
categoryLabelPrefix: "sizeup/"
commenting:
# Whether or not to comment on pull requests that exceed the configured score threshold
addCommentWhenScoreThresholdHasBeenExceeded: true
# The threshold above which we will add a comment to the assessed pull request.
scoreThreshold: 100
# The template for the comment that should be added to each pull request that
# exceeds the score threshold. Any of the following variables can be included
# in the template with surrounding curly braces (e.g. {{author}}) in order to
# interpolate a computed value into the comment:
#
# - author
# - threshold
# - score
# - category
scoreThresholdExceededCommentTemplate: |
👋 @{{author}} this pull request exceeds the configured reviewability score threshold of {{threshold}}. Your actual score was {{score}}.
# List of users for whom we should run this workflow
optIns:
Expand Down
6 changes: 4 additions & 2 deletions __tests__/test-configuration.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
applyCategoryLabels: false
addCommentWhenScoreThresholdHasBeenExceeded: false
labeling:
applyCategoryLabels: false
commenting:
addCommentWhenScoreThresholdHasBeenExceeded: false
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 26 additions & 20 deletions dist/config/default.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 35 additions & 18 deletions dist/config/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 26 additions & 20 deletions src/config/default.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# Whether or not to add a label to each pull request to indicate its assessed category
applyCategoryLabels: true
labeling:

# The prefix to add to each category label that we apply.
categoryLabelPrefix: "sizeup/"
# Whether or not to add a label to each pull request to indicate its assessed category
applyCategoryLabels: true

# Whether or not to add a comment to each assessed pull request that exceeds
# the configured score threshold.
addCommentWhenScoreThresholdHasBeenExceeded: true
# The prefix to add to each category label that we apply.
categoryLabelPrefix: "sizeup/"

# The template for the comment that should be added to each pull request that
# exceeds the score threshold. Any of the following variables can be included
# in the template with surrounding curly braces (e.g. {{author}}) in order to
# interpolate a computed value into the comment:
#
# - author
# - threshold
# - score
# - category
scoreThresholdExceededCommentTemplate: |
👋 @{{author}} this pull request exceeds the configured reviewability score threshold of {{threshold}}. Your actual score was {{score}}.
commenting:

[Research](https://www.cabird.com/static/93aba3256c80506d3948983db34d3ba3/rigby2013convergent.pdf) has shown that this makes it harder for reviewers to provide quality feedback.
# Whether or not to comment on pull requests that exceed the configured score threshold
addCommentWhenScoreThresholdHasBeenExceeded: true

We recommend that you reduce the size of this PR by separating commits into stacked PRs.
# The threshold above which we will add a comment to the assessed pull request.
scoreThreshold: 100

# The template for the comment that should be added to each pull request that
# exceeds the score threshold. Any of the following variables can be included
# in the template with surrounding curly braces (e.g. {{author}}) in order to
# interpolate a computed value into the comment:
#
# - author
# - threshold
# - score
# - category
scoreThresholdExceededCommentTemplate: |
👋 @{{author}} this pull request exceeds the configured reviewability score threshold of {{threshold}}. Your actual score was {{score}}.
[Research](https://www.cabird.com/static/93aba3256c80506d3948983db34d3ba3/rigby2013convergent.pdf) has shown that this makes it harder for reviewers to provide quality feedback.
We recommend that you reduce the size of this PR by separating commits into stacked PRs.
# Configuration for how to evaluate pull requests.
# This is of the same format that `sizeup` accepts directly.
Expand Down
Loading

0 comments on commit 593c1d7

Please sign in to comment.