From 31639037590ed2757e5bbf4589af3face51afc2a Mon Sep 17 00:00:00 2001 From: ayushrakesh Date: Tue, 25 Jun 2024 22:31:17 +0530 Subject: [PATCH 1/2] Added CI to verify the format of PR titles --- .github/workflows/pr-title-check.yaml | 37 +++++++++++++++++++++++++++ CONTRIBUTING.md | 28 ++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/pr-title-check.yaml diff --git a/.github/workflows/pr-title-check.yaml b/.github/workflows/pr-title-check.yaml new file mode 100644 index 0000000000..05d907f403 --- /dev/null +++ b/.github/workflows/pr-title-check.yaml @@ -0,0 +1,37 @@ +name: Verify PR Title + +on: + pull_request: + types: [opened, edited, reopened] + +jobs: + verify-title: + runs-on: ubuntu-latest + + steps: + - name: Check out the repository + uses: actions/checkout@v2 + + - name: Verify PR Title + id: verify + run: | + PREFIXES="query|compactor|query-frontend|receiver|rule|sidecar|store|tools|\.\*" + + IFS=',' read -ra PREFIX_ARRAY <<< "${PREFIXES}" + VALID=0 + + for PREFIX in "${PREFIX_ARRAY[@]}"; do + PREFIX="${PREFIX}:" + if [[ "${{ github.event.pull_request.title }}" =~ ^(${PREFIXES}):.* ]]; then + VALID=1 + break + fi + done + + if [[ $VALID -eq 0 ]]; then + echo "PR title does not follow the required format: 'prefix: description'" + echo "::error::PR title must start with one or more of the following prefixes: query:, compactor:, query-frontend:, receiver:, rule:, sidecar:, store:, tools:, .*:" + exit 1 + else + echo "PR title is valid." + fi diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7ef8298215..0cec01823f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -185,6 +185,34 @@ It is a good practice to keep your branch updated by rebasing your branch to mai * If you feel like your PR is waiting too long for a review, feel free to ping the [`#thanos-dev`](https://slack.cncf.io/) channel on our slack for a review! * If you are a new contributor with no write access, you can tag in the respective maintainer for the changes, but be patient enough for the reviews. *Remember, good things take time :)* +### Pull Request Title Format + +When submitting a pull request (PR), please ensure that the title follows the specified format: + +#### Prefixes + +PR titles must start with one of the following prefixes: +- `query:` +- `compactor:` +- `query-frontend:` +- `receiver:` +- `rule:` +- `sidecar:` +- `store:` +- `tools:` +- `.*:` (any string followed by a colon) + +Or combinations of components: +- `query,store: Enhance data retrieval efficiency` + +#### Examples of Valid PR Titles + +- `query: Improve query performance` +- `receiver: Fix bug in data processing` +- `feature: Add new logging functionality` + +PR titles that do not adhere to this format will not pass the automated title verification and may be rejected. + ### Dependency management The Thanos project uses [Go modules](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more) to manage dependencies on external packages. This requires a working Go environment with version 1.11 or greater and git installed. From e473d60217124dc7a1bbfb10af3351ccfaf64b3b Mon Sep 17 00:00:00 2001 From: ayushrakesh Date: Tue, 25 Jun 2024 22:44:41 +0530 Subject: [PATCH 2/2] Updated CI Signed-off-by: ayushrakesh --- .github/workflows/pr-title-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-title-check.yaml b/.github/workflows/pr-title-check.yaml index 05d907f403..b350d16ae2 100644 --- a/.github/workflows/pr-title-check.yaml +++ b/.github/workflows/pr-title-check.yaml @@ -15,7 +15,7 @@ jobs: - name: Verify PR Title id: verify run: | - PREFIXES="query|compactor|query-frontend|receiver|rule|sidecar|store|tools|\.\*" + PREFIXES="query|compactor|query-frontend|receiver|rule|sidecar|store|tools|\\.\*" IFS=',' read -ra PREFIX_ARRAY <<< "${PREFIXES}" VALID=0