diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..d3789377 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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] diff --git a/.github/ISSUE_TEMPLATE/documentation_issue.md b/.github/ISSUE_TEMPLATE/documentation_issue.md new file mode 100644 index 00000000..053caa54 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_issue.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/enhancement_request.md b/.github/ISSUE_TEMPLATE/enhancement_request.md new file mode 100644 index 00000000..0e702752 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement_request.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..f20f96f8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml deleted file mode 100644 index 23c3cbde..00000000 --- a/.github/pr-labeler.yml +++ /dev/null @@ -1,4 +0,0 @@ -enhancement: ['feature/*', 'feat/*'] -bugfix: ['bugfix/*', 'fix/*'] -refactor: ['refactor/*'] -doc: ['doc/*'] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 3e23edb0..59e391f7 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -7,14 +7,11 @@ categories: - 'enhancement' - title: '🐛 Bug Fixes' labels: - - 'fix' - 'bugfix' - - 'bug' - title: '🧰 Maintenance' labels: - 'chore' - - 'refactor' - - 'doc' + - 'documentation' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: diff --git a/.github/workflows/add-comment-on-pr.yml b/.github/workflows/add-comment-on-pr.yml new file mode 100644 index 00000000..529088d8 --- /dev/null +++ b/.github/workflows/add-comment-on-pr.yml @@ -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); diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 75dbce71..ee8dde9d 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -1,4 +1,4 @@ -name: CI PIPELINE +name: UNIT TEST ACTION on: pull_request: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index da9b847d..5da1757c 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,4 +1,4 @@ -name: golangci-lint +name: Golangci-lint Action on: push: branches: diff --git a/.github/workflows/label-issue.yml b/.github/workflows/label-issue.yml new file mode 100644 index 00000000..b799364b --- /dev/null +++ b/.github/workflows/label-issue.yml @@ -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 + }); + } diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 00000000..17d12448 --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -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) }); + } diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml deleted file mode 100644 index 11d55e47..00000000 --- a/.github/workflows/pr-labeler.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: PR Labeler -on: - pull_request_target: - types: [opened] - -permissions: write-all - -jobs: - pr-labeler: - permissions: write-all - runs-on: ubuntu-latest - steps: - - uses: TimonVS/pr-labeler-action@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index c0c0841b..68743161 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,4 +1,4 @@ -name: Release Drafter +name: Release Drafter Action on: push: diff --git a/scripts/add-version-label-to-pr.sh b/scripts/add-version-label-to-pr.sh new file mode 100644 index 00000000..65fac18a --- /dev/null +++ b/scripts/add-version-label-to-pr.sh @@ -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