Skip to content

Commit

Permalink
feat: use go errors (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
shipengqi authored Aug 14, 2023
1 parent 46eb1ef commit 2ea3264
Show file tree
Hide file tree
Showing 25 changed files with 390 additions and 1,076 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: log-version
attributes:
label: log version
description: "`log --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
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "08:00"
labels:
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"
28 changes: 28 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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/**/*

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 log!

# 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 }}
65 changes: 0 additions & 65 deletions .github/workflows/ci.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "codeql"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
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
18 changes: 18 additions & 0 deletions .github/workflows/gitleaks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: gitleaks
on:
push:
branches: ['main']
tags: ['v*']
pull_request:
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 }}
20 changes: 20 additions & 0 deletions .github/workflows/grype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "grype"
on:
push:
branches: ['main']
tags: ['v*']
pull_request:
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
32 changes: 32 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
permissions:
contents: read

jobs:
golangci:
strategy:
matrix:
go: [ '1.20', '1.21' ]
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
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@v5
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 }}
Loading

0 comments on commit 2ea3264

Please sign in to comment.