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
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.git
.github
.env
.DS_Store
/dist
/labelsync
docs
taskfiles
.dockerignore
.editorconfig
.gitignore
.golangci.yml
.goreleaser.yml
.markdownlint-cli2.yaml
AGENTS.md
CLAUDE.md
compose.yml
Dockerfile
LICENSE
README.md
Taskfile.dist.yml
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[*.{neon,go}]
indent_style = tab
57 changes: 57 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Config options: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
labels:
- dependencies
- github-actions
commit-message:
prefix: build
include: scope
groups:
specsnl-actions:
patterns:
- "specsnl/github-actions*"

- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
labels:
- dependencies
- go
commit-message:
prefix: build
include: scope
groups:
go-dependencies:
update-types:
- minor
- patch

- package-ecosystem: docker
directory: /
schedule:
interval: weekly
labels:
- dependencies
- docker
commit-message:
prefix: build
include: scope
groups:
debian-minor-patch:
patterns:
- debian
update-types:
- minor
- patch
debian-major:
patterns:
- debian
update-types:
- major
63 changes: 63 additions & 0 deletions .github/rulesets/Main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "Main",
"target": "branch",
"source_type": "Repository",
"source": "specsnl/labelsync",
"enforcement": "active",
"conditions": {
"ref_name": {
"exclude": [],
"include": [
"~DEFAULT_BRANCH"
]
}
},
"rules": [
{
"type": "deletion"
},
{
"type": "non_fast_forward"
},
{
"type": "pull_request",
"parameters": {
"required_approving_review_count": 0,
"dismiss_stale_reviews_on_push": false,
"required_reviewers": [],
"require_code_owner_review": false,
"dismissal_restriction": {
"enabled": false,
"allowed_actors": []
},
"require_last_push_approval": false,
"required_review_thread_resolution": true,
"allowed_merge_methods": [
"merge"
]
}
},
{
"type": "required_status_checks",
"parameters": {
"strict_required_status_checks_policy": false,
"do_not_enforce_on_create": false,
"required_status_checks": [
{
"context": "Unit tests",
"integration_id": 15368
},
{
"context": "Integration tests",
"integration_id": 15368
},
{
"context": "Markdown gate",
"integration_id": 15368
}
]
}
}
],
"bypass_actors": []
}
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod

- name: Cache Go modules
uses: actions/cache@v6
with:
path: |
~/.cache/go/pkg/mod
~/.cache/go/build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.12

- name: Test
run: go test -race -count=1 ./...

- name: Build (smoke)
run: go build -o /dev/null .

57 changes: 57 additions & 0 deletions .github/workflows/md.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Markdown

on:
workflow_dispatch:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: read

jobs:
changes:
name: Changes Filter
runs-on: ubuntu-24.04
outputs:
mdlint: ${{ steps.filter.outputs.mdlint }}
steps:
- name: Checkout
if: github.event_name != 'pull_request'
uses: actions/checkout@v7

- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
mdlint:
- '**.md'
- '.markdownlint-cli2.yaml'
- '.github/workflows/md.yml'

mdlint:
name: Check markdown style
runs-on: ubuntu-24.04
needs: changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.mdlint == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7

- name: Lint Markdown files
uses: DavidAnson/markdownlint-cli2-action@v24

gate-mdlint:
name: Markdown gate
runs-on: ubuntu-24.04
needs: [changes, mdlint]
if: always()
steps:
- run: exit 1
if: needs.changes.result != 'success' || contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
- run: exit 0
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-go@v7
with:
go-version-file: go.mod

- uses: actions/cache@v6
with:
path: |
~/.cache/go/pkg/mod
~/.cache/go/build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.env
.DS_Store
/dev
Taskfile.yml

/labelsync
/dist/
16 changes: 16 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "2"
linters:
default: standard
enable:
- wsl_v5
- whitespace
- modernize
# - wrapcheck
settings:
errcheck:
# Output to stdout/stderr is best-effort: the output Writer interface has
# no error channel and reporting a write failure would itself need a
# working stream. See internal/util/output/writer.go.
exclude-functions:
- fmt.Fprintln
- charm.land/lipgloss/v2.Fprintln
46 changes: 46 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2

builds:
- id: labelsync
main: .
binary: labelsync
flags:
- -trimpath
- -tags=netgo
ldflags:
- -s -w
- -X github.com/specsnl/labelsync/internal/cmd.Version={{ .Version }}
env:
- CGO_ENABLED=0
goos: [linux, darwin]
goarch: [amd64, arm64]

archives:
- formats: [tar.gz]
name_template: "labelsync_{{ .Os }}_{{ .Arch }}{{ if .Arm }}_v{{ .Arm }}{{ end }}"

checksum:
name_template: "checksums.txt"

release:
github:
owner: specsnl
name: labelsync
draft: false
prerelease: auto

homebrew_casks:
- name: labelsync
repository:
owner: specsnl
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
homepage: "https://github.com/specsnl/labelsync"
description: "A Github label synchronization tool"
directory: Casks
hooks:
post:
install: |
if OS.mac?
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/labelsync"]
end
Loading