mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
ci: run govulncheck, semgrep, etc (#627)
* ci: run govulncheck, semgrep, etc Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: error check --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
9ebe39cd09
commit
401610afa4
3 changed files with 18 additions and 2 deletions
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
|
@ -10,3 +10,16 @@ jobs:
|
||||||
uses: charmbracelet/meta/.github/workflows/snapshot.yml@main
|
uses: charmbracelet/meta/.github/workflows/snapshot.yml@main
|
||||||
secrets:
|
secrets:
|
||||||
goreleaser_key: ${{ secrets.GORELEASER_KEY }}
|
goreleaser_key: ${{ secrets.GORELEASER_KEY }}
|
||||||
|
|
||||||
|
govulncheck:
|
||||||
|
uses: charmbracelet/meta/.github/workflows/govulncheck.yml@main
|
||||||
|
with:
|
||||||
|
go-version: stable
|
||||||
|
|
||||||
|
semgrep:
|
||||||
|
uses: charmbracelet/meta/.github/workflows/semgrep.yml@main
|
||||||
|
|
||||||
|
ruleguard:
|
||||||
|
uses: charmbracelet/meta/.github/workflows/ruleguard.yml@main
|
||||||
|
with:
|
||||||
|
go-version: stable
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -61,7 +63,7 @@ func ensureConfigFile() error {
|
||||||
return fmt.Errorf("'%s' is not a supported configuration type: use '%s' or '%s'", ext, ".yaml", ".yml")
|
return fmt.Errorf("'%s' is not a supported configuration type: use '%s' or '%s'", ext, ".yaml", ".yml")
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
if _, err := os.Stat(configFile); errors.Is(err, fs.ErrNotExist) {
|
||||||
// File doesn't exist yet, create all necessary directories and
|
// File doesn't exist yet, create all necessary directories and
|
||||||
// write the default config file
|
// write the default config file
|
||||||
if err := os.MkdirAll(filepath.Dir(configFile), 0o700); err != nil {
|
if err := os.MkdirAll(filepath.Dir(configFile), 0o700); err != nil {
|
||||||
|
|
3
main.go
3
main.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -148,7 +149,7 @@ func validateOptions(cmd *cobra.Command) error {
|
||||||
style = viper.GetString("style")
|
style = viper.GetString("style")
|
||||||
if style != glamour.AutoStyle && glamour.DefaultStyles[style] == nil {
|
if style != glamour.AutoStyle && glamour.DefaultStyles[style] == nil {
|
||||||
style = utils.ExpandPath(style)
|
style = utils.ExpandPath(style)
|
||||||
if _, err := os.Stat(style); os.IsNotExist(err) {
|
if _, err := os.Stat(style); errors.Is(err, fs.ErrNotExist) {
|
||||||
return fmt.Errorf("Specified style does not exist: %s", style)
|
return fmt.Errorf("Specified style does not exist: %s", style)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue