Skip to content
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
54 changes: 54 additions & 0 deletions .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Changelog

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version tag to generate changelog for (e.g. v1.0.0)"
required: true
type: string

permissions:
contents: write

jobs:
changelog:
name: Generate Changelog
runs-on: ubuntu-latest
env:
VERSION_TAG: ${{ inputs.version || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Generate changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose --tag ${{ env.VERSION_TAG }}
env:
OUTPUT: CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}

- name: Commit changelog
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "chore: update changelog for ${{ env.VERSION_TAG }}" || true
git push origin HEAD:main

- name: Create/update GitHub release body
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --verbose --latest --strip header
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
30 changes: 30 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Commit Lint

on:
pull_request:
branches:
- main

permissions:
contents: read

jobs:
commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install commitlint
run: npm install --save-dev @commitlint/{cli,config-conventional}

- name: Lint commits
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
71 changes: 71 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[changelog]
header = """
# Changelog

All notable changes to this project will be documented in this file.

This changelog is automatically generated based on [Conventional Commits](https://www.conventionalcommits.org/).\n
"""
body = """
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}

{% if version -%}
## [{{ version | trim_start_matches(pat="v") }}]\
{% if commit_id %}({{ self::remote_url() }}/tree/{{ version }}){% endif %}\
{% if timestamp %} - {{ timestamp | date(format="%Y-%m-%d") }}{% endif %}
{% else -%}
## [Unreleased]
{% endif -%}

{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- *({{ commit.scope }})* {{ commit.message | upper_first }}\
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
{% if commit.github.pr_number %} in \
[#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }})\
{%- endif %}
{%- endfor -%}
{% for commit in commits %}
{%- if not commit.scope %}
- {{ commit.message | upper_first }}\
{% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
{% if commit.github.pr_number %} in \
[#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }})\
{%- endif %}
{%- endif -%}
{%- endfor -%}
{% endfor %}
"""
footer = ""
trim = true

[git]
conventional_commits = true
filter_unconventional = false
split_commits = false
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^perf", group = "<!-- 2 -->⚡ Performance" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^example", group = "<!-- 4 -->📦 Examples" },
{ message = "^refactor", group = "<!-- 5 -->🔧 Refactoring" },
{ message = "^chore\\(deps\\)", group = "<!-- 6 -->📦 Dependencies" },
{ message = "^chore|^ci", group = "<!-- 7 -->🏗️ Maintenance" },
{ message = "^test", group = "<!-- 8 -->🧪 Testing" },
{ message = "^Bump ", group = "<!-- 6 -->📦 Dependencies" },
{ message = "^.*", group = "<!-- 9 -->🔀 Other" },
]
protect_breaking_commits = true
filter_commits = false
tag_pattern = "v[0-9].*"
sort_commits = "newest"

[remote.github]
owner = "awslabs"
repo = "aws-lambda-web-adapter"
26 changes: 26 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'example',
'examples',
'chore',
'refactor',
'perf',
'test',
'ci',
'revert',
],
],
'subject-case': [0],
'body-max-line-length': [0],
'footer-max-line-length': [0],
'header-max-length': [2, 'always', 120],
},
};
Loading