-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chore] Add Github Actions to add label on issue and PR (#297)
Signed-off-by: yandongxiao <[email protected]>
- Loading branch information
1 parent
9d7ef19
commit 9d2349a
Showing
14 changed files
with
232 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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,26 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: 'bug' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Describe the bug | ||
|
||
A clear and concise description of what the bug is. | ||
|
||
## To Reproduce | ||
|
||
Steps to reproduce the behavior: | ||
|
||
## Expected behavior | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
## Please complete the following information | ||
|
||
- Operator Version: [e.g. v1.8.5] | ||
- Chart Name: [e.g. kube-starrocks] | ||
- Chart Version [e.g. v1.8.5] |
This file contains 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,24 @@ | ||
--- | ||
name: Documentation | ||
about: Report an issue related to documentation | ||
title: '' | ||
labels: 'documentation' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Describe the issue with documentation | ||
|
||
A clear and concise description of what the issue is. | ||
|
||
## Page link | ||
|
||
If applicable, add the link to the page where the issue occurs. | ||
|
||
## Suggested change | ||
|
||
Describe what changes you suggest to improve the documentation. | ||
|
||
## Additional context | ||
|
||
Add any other context or screenshots about the documentation issue here. |
This file contains 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,20 @@ | ||
--- | ||
name: Enhancement request | ||
about: Propose an enhancement for this project | ||
title: '' | ||
labels: 'enhancement' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Describe the current behavior | ||
|
||
A clear and concise description of the current behavior. | ||
|
||
## Describe the enhancement | ||
|
||
A clear and concise description of what you want to improve. | ||
|
||
## Additional context | ||
|
||
Add any other context or screenshots about the enhancement here. |
This file contains 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,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'feature' | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Describe the problem | ||
|
||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
## Describe the solution you'd like | ||
|
||
A clear and concise description of what you want to happen. | ||
|
||
## Additional context | ||
|
||
Add any other context or screenshots about the enhancement here. |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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,27 @@ | ||
name: Add Comment Action | ||
on: | ||
pull_request: | ||
types: [closed] | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true | ||
steps: | ||
- name: Comment on PR | ||
uses: actions/github-script@v6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
script: | | ||
const prComment = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
body: 'Thank you for your contribution!' | ||
}; | ||
await github.rest.issues.createComment(prComment); |
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CI PIPELINE | ||
name: UNIT TEST ACTION | ||
|
||
on: | ||
pull_request: | ||
|
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: golangci-lint | ||
name: Golangci-lint Action | ||
on: | ||
push: | ||
branches: | ||
|
This file contains 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,43 @@ | ||
name: Label Issue Action | ||
on: | ||
issues: | ||
types: | ||
- reopened | ||
- opened | ||
permissions: | ||
issues: write | ||
jobs: | ||
label_issues: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Label issue | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const issueTitle = context.payload.issue.title.toLowerCase(); | ||
const labelsToAdd = []; | ||
if (issueTitle.includes('bug')) { | ||
labelsToAdd.push('bug'); | ||
} | ||
if (issueTitle.includes('feature')) { | ||
labelsToAdd.push('feature'); | ||
} | ||
if (issueTitle.includes('enhancement')) { | ||
labelsToAdd.push('enhancement'); | ||
} | ||
if (issueTitle.includes('documentation')) { | ||
labelsToAdd.push('documentation'); | ||
} | ||
if (labelsToAdd.length > 0) { | ||
await github.rest.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.issue.number, | ||
labels: labelsToAdd | ||
}); | ||
} |
This file contains 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,51 @@ | ||
name: Label PR Action | ||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
labeler: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Label PR based on commit messages | ||
uses: actions/github-script@v5 | ||
with: | ||
github-token: ${{ secrets.PAT }} | ||
script: | | ||
const { owner, repo, number: pull_number } = context.issue; | ||
const { data: commits } = await github.rest.pulls.listCommits({ owner, repo, pull_number }); | ||
const labels = new Set(); | ||
for (const { commit } of commits) { | ||
const message = commit.message.toLowerCase(); | ||
if (message.includes('feature')) { | ||
labels.add('feature'); | ||
} | ||
if (message.includes('enhancement')) { | ||
labels.add('enhancement'); | ||
} | ||
if (message.includes('bugfix')) { | ||
labels.add('bugfix'); | ||
} | ||
if (message.includes('chore')) { | ||
labels.add('chore'); | ||
} | ||
if (message.includes('documentation')) { | ||
labels.add('documentation'); | ||
} | ||
} | ||
if (labels.size > 0) { | ||
await github.rest.issues.addLabels({ owner, repo, issue_number: pull_number, labels: Array.from(labels) }); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Release Drafter | ||
name: Release Drafter Action | ||
|
||
on: | ||
push: | ||
|
This file contains 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,17 @@ | ||
#!/bin/bash | ||
|
||
# input parameters: a list of PR numbers and a version tag | ||
# e.g. v1.8.5 1 2 3 4 5 | ||
VERSION_TAG=$1 | ||
|
||
# create label by gh | ||
gh label create $VERSION_TAG | ||
|
||
shift | ||
PR_NUMBERS=("$@") | ||
|
||
# iterate over the list of PR numbers | ||
for PR_NUMBER in "${PR_NUMBERS[@]}"; do | ||
# add a version label to each PR | ||
gh pr edit $PR_NUMBER --add-label "$VERSION_TAG" | ||
done |