Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable automatic labeling of PRs via Actions #3431

Merged
merged 7 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from 6 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
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Thank you for contributing to Velero!

# Please add a summary of your change

# Does your change fix a particular issue?

Fixes #(issue)

# Please indicate you've done the following:

[ ] [Accepted the DCO](https://velero.io/docs/v1.5/code-standards/#dco-sign-off). Commits without the DCO will delay acceptance.
[ ] [Created a changelog file](https://velero.io/docs/v1.5/code-standards/#adding-a-changelog) or added `/kind changelog-not-required`.
[ ] Updated the corresponding documentation in `site/content/docs/main`.
40 changes: 40 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
area:
- "Cloud/AWS"
- "Cloud/GCP"
- "Cloud/Azure"
- "Plugins"

# Labels that can be applied to PRs with the /kind command
kind:
- "changelog-not-required"
- "Tech debt"

# Works with https://github.com/actions/labeler/
# Below this line, the keys are labels to be applied, and the values are the file globs to match against.
# Anything in the `design` directory gets the `Design` label.
Design:
- design/*

# Anything in the site directory gets the website label *EXCEPT* docs
Website:
- any: ["site/**/*", "!site/content/docs/**/*"]

Documentation:
- site/content/docs/**/*

Dependencies:
- go.mod

# Anything that has plugin infra will be labeled.
# Individual plugins don't necessarily live here, though
Plugins:
- "pkg/plugins/**/*"

has-unit-tests:
- "pkg/**/*_test.go"

has-e2e-2tests:
- "test/e2e/**/*"

has-changelog:
- "changelogs/**"
13 changes: 13 additions & 0 deletions .github/workflows/label-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This workflow automatically labels issues based on the changed filepaths
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labels.yaml
20 changes: 20 additions & 0 deletions .github/workflows/prow-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Adds support for prow-like commands
# Uses .github/labels.yaml to define areas and kinds
name: "Prow github actions"
on:
issue_comment:
types: [created]

jobs:
execute:
runs-on: ubuntu-latest
steps:
- uses: jpmcb/prow-github-actions@v1
with:
# Only support /kind command for now.
# TODO: before allowing the /lgtm command, see if we can block merging if changelog labels are missing.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we can use the /lgtm command, but make it work only if there's either a has-changelog (which should be set with the action on this PR) or changelog-not-required label on the PR.

I think this way, we could retire the confusing changelog CI check that marks a perfectly-fine PR as failing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm 😆

prow-commands: "/area
/kind
/cc
/uncc"
github-token: "${{ secrets.GITHUB_TOKEN }}"
12 changes: 1 addition & 11 deletions site/content/docs/main/code-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@ toc: "true"

## Opening PRs

Some PRs do not require a CI build. Those will be changes to documentation, to the website, and any other change that doesn't involve code, such as releases, typo fixes.

To bypass the CI build, use anyone of these labels (any one of them will do the job):
- Design: any design document
- Website: any change to the website that is not documentation
- Documentation: documentation for releases or any markdown file in the repo
- changelog-not-required: use only when the PR is not addressing any of the above cases. This is for changes in the code that is not introducing any change in behavior for the software.

There is no need to use more than one label.

Please add the label BEFORE creating the PR/draft. This will make the CI check pass. If you forget, it's ok: adding it after will make the CI fail, but it will still let us merge. The only minor downside is that it will have a red checkmark for failure.
When opening a pull request, please fill out the checklist supplied the template. This will help others properly categorize and review your pull request.

## Adding a changelog

Expand Down
12 changes: 1 addition & 11 deletions site/content/docs/v1.5/code-standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@ toc: "true"

## Opening PRs

Some PRs do not require a CI build. Those will be changes to documentation, to the website, and any other change that doesn't involve code, such as releases, typo fixes.

To bypass the CI build, use anyone of these labels (any one of them will do the job):
- Design: any design document
- Website: any change to the website that is not documentation
- Documentation: documentation for releases or any markdown file in the repo
- changelog-not-required: use only when the PR is not addressing any of the above cases. This is for changes in the code that is not introducing any change in behavior for the software.

There is no need to use more than one label.

Please add the label BEFORE creating the PR/draft. This will make the CI check pass. If you forget, it's ok: adding it after will make the CI fail, but it will still let us merge. The only minor downside is that it will have a red checkmark for failure.
When opening a pull request, please fill out the checklist supplied the template. This will help others properly categorize and review your pull request.

## Adding a changelog

Expand Down