Skip to content
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
2 changes: 2 additions & 0 deletions nix/general/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ importingFlake: {
imports = [
./action-versions.nix
(importApply ./devshell.nix args)
(importApply ./git-cliff.nix args)
(importApply ./pre-commit-hooks.nix args)
./ff-merge_workflow.nix
];

# Install all defined GitHub workflows
Expand Down
4 changes: 3 additions & 1 deletion nix/general/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ importingFlake: {
perSystem =
{ lib, pkgs, ... }:
{
devshells.general.packages = lib.attrValues { inherit (pkgs) prek; };
devshells.general.packages = lib.attrValues {
inherit (pkgs) prek git-cliff;
};

filegen.settings.files = [
{
Expand Down
43 changes: 43 additions & 0 deletions nix/general/ff-merge_workflow.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{ config, ... }:
let
allowed-actions = config.famedly.standards.allowed-action-versions;
in
{
perSystem =
{ ... }:
{
githubActions.workflows.ff-merge = {
name = "fast-forward";

on.issueComment.types = [
"created"
"edited"
];

jobs.fast-forward = {
if_ = "\${{ contains(github.event.comment.body, '/fast-forward') && github.event.issue.pull_request }}";

runsOn = "ubuntu-latest";

permissions = {
contents = "write";
pull-requests = "write";
issues = "write";
};

steps = [
{
name = "Fast forwarding";
uses = allowed-actions."sequoia-pgp/fast-forward".uses;
with_ = {
merge = true;
# Only post comments about fast-forwarding if
# there is an error.
comment = "on-error";
Comment thread
mzaniolo marked this conversation as resolved.
};
}
];
};
};
};
}
14 changes: 14 additions & 0 deletions nix/general/git-cliff.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
importingFlake: {
perSystem =
{ ... }:
{
filegen.settings.files = [
{
type = "copy";
target = "./.config/cliff.toml";
source = ../../standards/cliff.toml;
clobber = true;
}
];
};
}
Comment thread
mzaniolo marked this conversation as resolved.
4 changes: 4 additions & 0 deletions standards/allowed-github-actions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ ref = "51f3067b56fe8ae331890c77d4e454f6d60615ff"
["cachix/cachix-action"]
rev = "v17"
ref = "1eb2ef646ac0255473d23a5907ad7b04ce94065c"

["sequoia-pgp/fast-forward"]
rev = "v1.0.0"
ref = "ea7628bedcb0b0b96e94383ada458d812fca4979"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you double check this ref is currently permitted?

83 changes: 83 additions & 0 deletions standards/cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# template for the changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**] {% endif %}\
{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]
# render body even when there are no releases to process
# render_always = true
# output file path
# output = "test.md"

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# Replace issue numbers
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->Features" },
{ message = "^fix", group = "<!-- 1 -->Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->Documentation" },
{ message = "^perf", group = "<!-- 4 -->Performance" },
{ message = "^refactor", group = "<!-- 2 -->Refactor" },
{ message = "^style", group = "<!-- 5 -->Styling" },
{ message = "^test", group = "<!-- 6 -->Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps.*\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|^ci", group = "<!-- 7 -->Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->Security" },
{ message = "^revert", group = "<!-- 9 -->Revert" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = false
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"