Skip to content

Commit

Permalink
chore: add workflows (#20)
Browse files Browse the repository at this point in the history
* WIP(workflow): add workflows and issue, PR templates

* WIP(docs): installation guide

* fix(command): add version command

* WIP(doc): update doc for multiple templates
  • Loading branch information
shipengqi authored Mar 8, 2024
1 parent bc33621 commit 92e3c21
Show file tree
Hide file tree
Showing 23 changed files with 469 additions and 12 deletions.
54 changes: 54 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Bug Report
description: Tell us about a problem you are experiencing
labels: [bug, triage]
assignees:
- shipengqi
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! Please fill the form below.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
validations:
required: true
- type: textarea
id: reproducible
attributes:
label: How can we reproduce this?
description: Please share a public repository that reproduces the issue, or an example config file.
validations:
required: true
- type: textarea
id: commitizen-version
attributes:
label: commitizen version
description: "`commitizen --version` output"
render: bash
validations:
required: true
- type: textarea
id: os
attributes:
label: OS
description: "e.g. from `/etc/os-release`"
render: bash
validations:
required: true
- type: checkboxes
id: search
attributes:
label: Search
options:
- label: I did search for other open and closed issues before opening this
required: true
- type: textarea
id: ctx
attributes:
label: Additional context
description: Anything else you would like to add
validations:
required: false
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Feature Request
description: Request a new feature and/or enhancement to an existing feature
labels: [enhancement, triage]
assignees:
- shipengqi
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request! Please fill the form below.
- type: textarea
id: is-it-a-problem
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: checkboxes
id: search
attributes:
label: Search
options:
- label: I did search for other open and closed issues before opening this
required: true
- type: textarea
id: ctx
attributes:
label: Additional context
description: Anything else you would like to add
validations:
required: false
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: "gomod"
assignees:
- "shipengqi"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
- package-ecosystem: "github-actions"
assignees:
- "shipengqi"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"
29 changes: 29 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Works with https://github.com/actions/labeler/
# Below this line, the keys are labels to be applied, and the values are the file globs to match against.
# Anything in the `design` directory gets the `Design` label.
design:
- design/*

example:
- example/*
- examples/*

documentation:
- docs/**/*
- README.md

dependencies:
- go.mod
- go.sum

hack:
- hack/*

unit-tests:
- "pkg/**/*_test.go"
- "cmd/**/*_test.go"
- "config/**/*_test.go"
- "internal/**/*_test.go"

e2e-tests:
- "test/e2e/**/*"
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Thank you for contributing to commitizen!

# Please add a summary of your change

# Does your change fix a particular issue?

Fixes #(issue)

**Check list:**
- [ ] Mark if documentation changes are required.
- [ ] Mark if tests were added or updated to cover the changes.
21 changes: 21 additions & 0 deletions .github/workflows/autolabel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Auto Label"
# pull_request_target means that this will run on pull requests, but in the context of the base repo.
# This should mean PRs from forks are supported.
# Because it includes the `synchronize` parameter, any push of a new commit to the HEAD ref of a pull request
# will trigger this process.

on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review]

jobs:
# Automatically labels PRs based on file globs in the change.
triage:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v4
with:
repo-token: ${{ secrets.PAT }}
30 changes: 30 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "codeql"
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
jobs:
analyze:
name: analyze
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable
# Initializes the CodeQL tools for scanning.
- uses: github/codeql-action/init@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- uses: github/codeql-action/autobuild@v2
- uses: github/codeql-action/analyze@v2
12 changes: 12 additions & 0 deletions .github/workflows/depsreview.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: dependency-review
on: [pull_request]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/dependency-review-action@v3
with:
allow-licenses: BSD-2-Clause, BSD-3-Clause, MIT, Apache-2.0, MPL-1.0, MPL-1.1, MPL-2.0
1 change: 1 addition & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

24 changes: 24 additions & 0 deletions .github/workflows/gitleaks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: gitleaks
on:
push:
branches: ['main']
tags: ['v*']
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
permissions:
contents: read
jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
26 changes: 26 additions & 0 deletions .github/workflows/grype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "grype"
on:
push:
branches: ['main']
tags: ['v*']
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
jobs:
scan-source:
name: scan-source
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
steps:
- uses: actions/checkout@v3
- uses: anchore/scan-action@v3
with:
path: "."
fail-build: true
38 changes: 38 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
permissions:
contents: read

jobs:
golangci:
strategy:
matrix:
go: [ '1.20', '1.21', '1.22'' ]
os: [ ubuntu-latest, windows-latest ]
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: stable # get the latest stable version from the go-versions repository manifest.
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=10m
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

22 changes: 22 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.PAT }}
31 changes: 31 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
run:
# Include test files or not.
# Default: true
tests: false

linters:
disable-all: true
enable:
- misspell
- govet
- staticcheck
- errcheck
- unparam
- ineffassign
- nakedret
- gocyclo
- dupl
- goimports
- revive
- gosec
- gosimple
- typecheck
- unused

linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/shipengqi/commitizen
dupl:
threshold: 600
Loading

0 comments on commit 92e3c21

Please sign in to comment.