Skip to content

Commit

Permalink
Merge pull request #2 from ayushrakesh/check-PR
Browse files Browse the repository at this point in the history
feat: Github action to check PR's title format.
  • Loading branch information
ayushrakesh authored Jun 15, 2024
2 parents ceb0515 + 64a9389 commit 6528d34
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: PR Title Lint

on:
pull_request:
types: [opened, edited, synchronize]

jobs:
pr-title-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Run PR title linter
run: |
TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH")
if [[ ! "$TITLE" =~ ^(fix|feat|docs|style|refactor|perf|test|chore):\ .{1,50}$ ]]; then
echo "Invalid PR title: $TITLE"
echo "PR titles must start with one of the following types: fix, feat, docs, style, refactor, perf, test, chore."
echo "Followed by a colon and space, and a brief description (1-50 characters)."
exit 1
fi
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,32 @@ 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 Guidelines

To ensure a consistent and meaningful naming convention for pull requests (PRs), please follow these guidelines:

#### PR Title Format

PR titles should follow this pattern:
- `type: brief description`

Where `type` is one of the following:
- `fix`: A bug fix
- `feat`: A new feature
- `docs`: Documentation changes
- `style`: Code style changes (formatting, missing semi-colons, etc.)
- `refactor`: Code refactoring without changing functionality
- `perf`: Performance improvements
- `test`: Adding or updating tests
- `chore`: Maintenance tasks (dependency updates, tool changes, etc.)

#### Examples
- `fix: Correct typo in README`
- `feat: Add new storage backend support`
- `docs: Update contributing guidelines`

Failure to follow this convention will result in a failing check on your PR.

### 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

0 comments on commit 6528d34

Please sign in to comment.