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

Feature: Added CI to verify the format of PR titles. #7483

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
37 changes: 37 additions & 0 deletions .github/workflows/pr-title-check.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading