-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Auto label PRs #1518
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
Merged
ArthurSens
merged 14 commits into
prometheus:main
from
SachinSahu431:sachin/auto-label-pr
May 30, 2024
Merged
Auto label PRs #1518
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
334f0f7
Update CONTRIBUTING.md and PR template
SachinSahu431 bde1c78
Add workflow to auto label PRs
SachinSahu431 98e0b58
Revert duplicate changes
SachinSahu431 9675ca7
Update label config
SachinSahu431 3720378
Enhance regex to handle PR template
SachinSahu431 70d38e2
PR template (#42)
SachinSahu431 5b8d370
Merge branch 'main' into sachin/auto-label-pr
SachinSahu431 33aa5ba
Test pull_request
SachinSahu431 79812ee
Remove duplicate files
SachinSahu431 9a8e344
Add 'CHANGE' kind
SachinSahu431 269fb49
Add comment if labeler workflow fails
SachinSahu431 be7ef75
Modify PR-label validation workflow
SachinSahu431 e413851
Merge branch 'main' into sachin/auto-label-pr
kakkoyun 68c54a6
Update .github/workflows/pr-auto-label.yml
SachinSahu431 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Config file for pr-auto-label workflow | ||
|
||
# enable auto-labeler on issues, prs, or both. | ||
enable: | ||
prs: true | ||
|
||
# Labels is an object where: | ||
# - keys are labels | ||
# - values are objects of { include: [ pattern ], exclude: [ pattern ] } | ||
# - pattern must be a valid regex, and is applied globally to | ||
# title + description of issues and/or prs (see enabled config above) | ||
# - 'include' patterns will associate a label if any of these patterns match | ||
# - 'exclude' patterns will ignore this label if any of these patterns match | ||
labels: | ||
'kind/BUGFIX': | ||
include: | ||
- '/kind (fix|bugfix)' | ||
exclude: [] | ||
'kind/ENHANCEMENT': | ||
include: | ||
- '/kind enhancement' | ||
exclude: [] | ||
'kind/FEATURE': | ||
include: | ||
- '/kind (feat|feature)' | ||
exclude: [] | ||
'kind/CHANGE': | ||
include: | ||
- '/kind change' | ||
exclude: [] | ||
'release-note-none': | ||
include: | ||
- '/kind (none|NONE|release-note-none|release-notes-none)' | ||
exclude: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
name: PR-auto-labeler | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, edited, synchronize] | ||
|
||
permissions: | ||
contents: read # the config file | ||
pull-requests: write # for labeling pull requests (on: pull_request_target or on: pull_request) | ||
statuses: write # to generate status | ||
checks: write # to generate status | ||
|
||
jobs: | ||
pr-labeler: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Labels | ||
id: labeler | ||
uses: jimschubert/labeler-action@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Adjust the configuration in /.github/labeler.yml | ||
|
||
validate-pr-label: | ||
runs-on: ubuntu-latest | ||
needs: pr-labeler | ||
steps: | ||
- name: Verify Label | ||
id: preview_label_check | ||
uses: docker://agilepathway/pull-request-label-checker:latest | ||
with: | ||
any_of: kind/BUGFIX,kind/ENHANCEMENT,kind/FEATURE,kind/CHANGE,release-note-none | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
allow_failure: true | ||
- name: Comment on Label Check Failure | ||
uses: thollander/actions-comment-pull-request@v2.5.0 | ||
if: steps.preview_label_check.outputs.label_check == 'failure' | ||
with: | ||
message: | | ||
PR body does not contain a valid type of change. Please refer to [CONTRIBUTING.md](https://github.com/prometheus/client_golang/blob/main/CONTRIBUTING.md#how-to-fill-the-pr-template) for more information. | ||
comment_tag: labelfailure | ||
mode: recreate | ||
- name: Remove Label Check Failure Comment | ||
uses: thollander/actions-comment-pull-request@v2.5.0 | ||
if: steps.preview_label_check.outputs.label_check == 'success' | ||
with: | ||
message: | | ||
PR body contains a valid type of change. | ||
comment_tag: labelfailure | ||
mode: delete | ||
create_if_not_exists: false | ||
- name: Exit on Failure | ||
if: steps.preview_label_check.outputs.label_check == 'failure' | ||
run: exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a b
3145
atch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.