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

ci: attempt to enable commit-lint again #62

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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
1 change: 0 additions & 1 deletion .commitlintrc.ts

This file was deleted.

16 changes: 11 additions & 5 deletions .dagger/commitlint.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,34 @@ func (m *HomeInfra) LintCommits(
// +default="commitlint/commitlint:19.4.1"
image string,
// +optional
// +default="main"
base,
// +optional
branch,
// +optional
// lower range of the commit range
from string,
// +optional
// upper range of the commit range
to string,
) (string, error) {
args := []string{"--color", "--verbose"}
args := []string{"--color", "--verbose", "--extends", "@commitlint/config-conventional"}
if from != "" {
args = append(args, "--from", from)
} else {
args = append(args, "--from", base)
}
if to != "" {
args = append(args, "--to", to)
}
if from == "" && to == "" {
args = append(args, "--last")
}
// if from == "" && to == "" {
// args = append(args, "--last")
// }

ctr := dag.
Container().
From(image).
WithDirectory("/src/.git", m.GitDir).
WithFile("/src/.commitlintrc.ts", m.Source.File("/.commitlintrc.ts")).
WithWorkdir("/src").
WithExec(args, dagger.ContainerWithExecOpts{UseEntrypoint: true})

Expand Down
12 changes: 12 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"customizations": {
"vscode": {
"extensions": [
"mkhl.direnv"
]
}
},
"image": "ghcr.io/cachix/devenv:latest",
"overrideCommand": false,
"updateContentCommand": "devenv test"
}
1 change: 1 addition & 0 deletions .github/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (ci *CI) WithPipeline(
// Generate Github Actions to call our Dagger pipelines
func (ci *CI) Generate() *dagger.Directory {
return ci.
WithPipeline("commitlint", "lint-commits --from '${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }}' --to '${{ github.event.pull_request.head.sha }}'").
WithPipeline("check", "--gh-token=env:GITHUB_TOKEN --gh-event-name '${{ github.event_name }}' --gh-event '${{ github.event_path }}' check").
Gha.Config()
}
204 changes: 204 additions & 0 deletions .github/workflows/commitlint.gen.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ pkgs, inputs, ... }:

{
devcontainer.enable = true;

packages = [
pkgs.git
pkgs.nixfmt-rfc-style
Expand All @@ -11,6 +13,8 @@
nix.enable = true;
go.enable = true;
go.package = pkgs.go_1_23;
terraform.enable = true;
terraform.package = pkgs.opentofu;
};

pre-commit.hooks = {
Expand All @@ -19,8 +23,6 @@
};
};

languages.python.enable = true;

# https://github.com/cachix/devenv/pull/1317
# treefmt = {
# programs.nixfmt.enable = true;
Expand Down
Loading
Loading