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

chore: update document and workfolws #4

Merged
merged 2 commits into from
Sep 13, 2023
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
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"
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ example:

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

dependencies:
- go.mod
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: "codeql"
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
jobs:
analyze:
name: analyze
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/gitleaks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ on:
push:
branches: ['main']
tags: ['v*']
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
permissions:
contents: read
jobs:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/grype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ on:
push:
branches: ['main']
tags: ['v*']
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
jobs:
scan-source:
name: scan-source
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ on:
- v*
branches:
- main
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
permissions:
contents: read

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ name: test
on:
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'README.md'

jobs:
unit-test:
Expand All @@ -19,6 +25,7 @@ jobs:
- name: codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
fail_ci_if_error: true
files: coverage.out
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Inspired by [Cobra](https://github.com/spf13/cobra). Cobra is a library for crea
[![Release](https://img.shields.io/github/release/shipengqi/action.svg)](https://github.com/shipengqi/action/releases)
[![License](https://img.shields.io/github/license/shipengqi/action)](https://github.com/shipengqi/action/blob/main/LICENSE)

## Quickstart
## Getting Started

```go
cmd := &cobra.Command{
Expand All @@ -31,10 +31,10 @@ cmd := &cobra.Command{

func newSubAction1() *action.Action {
return &action.Action{
Name: "sub-action1",
Executable: func(act *action.Action) bool {
// do something
return true
Name: "sub-action1",
Executable: func(act *action.Action) bool {
// do something
return true
},
Run: func(act *action.Action) error { return nil },
}
Expand All @@ -53,8 +53,16 @@ func newSubAction2() *action.Action {
```

- `Executable`: whether is an executable action.
- `Execute()` will find the first executable action of the root action and execute it.
- `action.Execute()` will find the first executable action of the root action and execute it. If no executable action can be found, run the current action.


## Documentation

You can find the docs at [go docs](https://pkg.go.dev/github.com/shipengqi/action).


## 🔋 JetBrains OS licenses

`action` had been being developed with **GoLand** under the **free JetBrains Open Source license(s)** granted by JetBrains s.r.o., hence I would like to express my thanks here.

<a href="https://www.jetbrains.com/?from=action" target="_blank"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" alt="JetBrains Logo (Main) logo." width="250" align="middle"></a>