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

Add changelog to GitHub releases #941

Merged
merged 2 commits into from
Jan 7, 2025
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
9 changes: 9 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ jobs:
uses: actions/download-artifact@v4
with:
path: dist/
- name: Generate changelog
id: changelog
uses: requarks/changelog-action@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag: ${{ github.ref_name }}
writeToFile: false
includeRefIssues: false
useGitmojis: false
- name: Create GitHub release
uses: "softprops/action-gh-release@v2"
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
git config user.email github-actions@github.com
git checkout -b ${{ steps.branch.outputs.release_branch }}
git add -A
git commit -m "Bump to ${{steps.bump.outputs.new_version}}"
git commit -m "Release ${{steps.bump.outputs.new_version}}"
git push origin ${{ steps.branch.outputs.release_branch }}
git checkout master
git merge ${{ steps.branch.outputs.release_branch }}
Expand Down
19 changes: 19 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# (C) 2025 GoodData Corporation
[general]
# do not enforce maximum line length rules
ignore=T1, B1, B2, B5, T5

# prevent a warning about regexes in the ignore-by-title section
regex-style-search=true

# enable our extended conventional commits rule
extra-path=packages/repo-tools/src/quiver_monorepo/conventional_commit_gitlint_rule.py

# ignore all release commits (merge and revert commits are ignored by default)
[ignore-by-title]
regex=^Release(.*)
ignore=all

# add the most likely scopes for each package
[gdc-title-conventional-commits]
scopes=gooddata-api-client,gooddata-dbt,gooddata-fdw,gooddata-flexconnect,gooddata-flight-server,gooddata-pandas,gooddata-sdk
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ repos:
args: [ "--update", "FILES" ]
language: script
types: [ text ]
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-r ./tox-requirements.txt
-r ./release-requirements.txt

pre-commit~=4.0.1
gitlint~=0.19.1

-r ./fmt-requirements.txt

Expand Down
67 changes: 67 additions & 0 deletions scripts/conventional_commit_gitlint_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# (C) 2025 GoodData Corporation
"""
An extension of the CT1 rule from gitlint to enforce the conventional commit format.
This version also allows specifying allowed scope values.
"""

import re

from gitlint.options import ListOption
from gitlint.rules import CommitMessageTitle, LineRule, RuleViolation

RULE_REGEX = re.compile(r"([^(]+?)(?:\(([^)]+?)\))?!?: .+")

DEFAULT_TYPES = [
"fix",
"feat",
"chore",
"docs",
"style",
"refactor",
"perf",
"test",
"revert",
"ci",
"build",
]
DEFAULT_SCOPES = []


class ConventionalCommit(LineRule):
"""This rule enforces the spec at https://www.conventionalcommits.org/."""

name = "gdc-title-conventional-commits"
id = "GD1"
target = CommitMessageTitle

options_spec = [
ListOption(
"types",
DEFAULT_TYPES,
"Comma separated list of allowed commit types.",
),
ListOption(
"scopes",
DEFAULT_SCOPES,
"Comma separated list of allowed commit scopes.",
),
]

def validate(self, line, _commit):
violations = []
match = RULE_REGEX.match(line)

if not match:
msg = "Title does not follow ConventionalCommits.org format 'type(optional-scope): description'"
violations.append(RuleViolation(self.id, msg, line))
else:
line_commit_type = match.group(1)
line_commit_scope = match.group(2)
if line_commit_type not in self.options["types"].value:
opt_str = ", ".join(self.options["types"].value)
violations.append(RuleViolation(self.id, f"Title does not start with one of {opt_str}", line))
if line_commit_scope and line_commit_scope not in self.options["scopes"].value:
opt_str = ", ".join(self.options["scopes"].value)
violations.append(RuleViolation(self.id, f"Scope is defined and is not one of {opt_str}", line))

return violations
Loading