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

Switch from SemVer PR labels to Conventional Commits #21

Merged
merged 2 commits into from
Oct 11, 2024
Merged
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
16 changes: 16 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
extends: '@commitlint/config-conventional'

rules:
# See: https://commitlint.js.org/reference/rules.html
#
# Rules are made up by a name and a configuration array. The configuration array contains:
#
# * Severity [0..2]: 0 disable rule, 1 warning if violated, or 2 error if violated
# * Applicability [always|never]: never inverts the rule
# * Value: value to use for this rule
#
# Run `npx commitlint --print-config` to see the current setting for all rules.
#
body-leading-blank: [2, 'always']
footer-leading-blank: [2, 'always']
21 changes: 21 additions & 0 deletions .github/workflows/enforce_conventional_commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Conventional Commits

on:
pull_request:
branches:
- main

jobs:
commit-lint:
name: Verify Conventional Commits

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with: { fetch-depth: 0 }

- name: Check Commit Messages
uses: wagoid/commitlint-github-action@v6
with: { configFile: .commitlintrc.yml }
12 changes: 0 additions & 12 deletions .github/workflows/semver_pr_label_check.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
/rspec-report.xml
/rubocop-report.json
/sig

node_modules
package-lock.json
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
[![Build Status](https://github.com/main-branch/drive_v3/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/main-branch/drive_v3/actions/workflows/continuous_integration.yml)
[![Maintainability](https://api.codeclimate.com/v1/badges/aeebc016487c5cad881e/maintainability)](https://codeclimate.com/github/main-branch/drive_v3/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/aeebc016487c5cad881e/test_coverage)](https://codeclimate.com/github/main-branch/drive_v3/test_coverage)
[![Conventional
Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
[![Slack](https://img.shields.io/badge/slack-main--branch/drive__v3-yellow.svg?logo=slack)](https://main-branch.slack.com/archives/C07NG2J1C72)

Unofficial helpers and extensions for the Google Drive V3 API
Expand Down Expand Up @@ -45,6 +47,8 @@ Gems in the Google API helper, extensions, and examples series:
* [Working with colors](#working-with-colors)
* [Development](#development)
* [Contributing](#contributing)
* [Commit message guidelines](#commit-message-guidelines)
* [Pull request guidelines](#pull-request-guidelines)
* [License](#license)

## Installation
Expand Down Expand Up @@ -440,6 +444,32 @@ commits and the created tag, and push the `.gem` file to

Bug reports and pull requests are welcome on [the main-branch/drive_v3 GitHub project](https://github.com/main-branch/drive_v3).

### Commit message guidelines

All commit messages must follow the [Conventional Commits
standard](https://www.conventionalcommits.org/en/v1.0.0/). This helps us maintain a
clear and structured commit history, automate versioning, and generate changelogs
effectively.

To ensure compliance, this project includes:

* A git commit-msg hook that validates your commit messages before they are accepted.

To activate the hook, you must have node installed and run `npm install`.

* A GitHub Actions workflow that will enforce the Conventional Commit standard as
part of the continuous integration pipeline.

Any commit message that does not conform to the Conventional Commits standard will
cause the workflow to fail and not allow the PR to be merged.

### Pull request guidelines

All pull requests must be merged using rebase merges. This ensures that commit
messages from the feature branch are preserved in the release branch, keeping the
history clean and meaningful.


## License

The gem is available as open source under the terms of the
Expand Down
11 changes: 9 additions & 2 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -vx

# set -vx

bundle install

# Do any other automated setup that you need to do here
if [ -x "$(command -v npm)" ]; then
npm install
else
echo "npm is not installed"
echo "Install npm then re-run this script to enable the conventional commit git hook."
fi
2 changes: 1 addition & 1 deletion drive_v3.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
]

spec.add_development_dependency 'bundler-audit', '~> 0.9'
spec.add_development_dependency 'create_github_release', '~> 1.5'
spec.add_development_dependency 'create_github_release', '~> 2.1'
spec.add_development_dependency 'main_branch_shared_rubocop_config', '~> 0.1'
spec.add_development_dependency 'rake', '~> 13.2'
spec.add_development_dependency 'rspec', '~> 3.13'
Expand Down
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"husky": "^9.1.0"
},
"scripts": {
"postinstall": "husky",
"prepare": "husky"
}
}