Skip to content

Commit

Permalink
ci: add golang ci lint workflow (#5)
Browse files Browse the repository at this point in the history
* readme: update with help text

* ci: add lint workflow

* fix lint errors
  • Loading branch information
scriptnull authored Oct 24, 2024
1 parent de8aecb commit 3630d34
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 22 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# ddn-assets

DDN asset management tool
DDN asset management tool. This tool takes [ndc-hub](https://github.com/hasura/ndc-hub) as the source of information and produces assets for usage in Hasura DDN.

# Run
## Usage

```
NDC_HUB_GIT_REPO_FILE_PATH="~/ndc-hub" ddn-assets
Tool for managing Hasura DDN assets
Usage:
ddn-assets [flags]
ddn-assets [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
generate Generate assets
help Help about any command
validate Validate assets
Flags:
-h, --help help for ddn-assets
Use "ddn-assets [command] --help" for more information about a command.
```
34 changes: 15 additions & 19 deletions cmd/validate.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
package cmd

import (
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
)

var validateCmd = &cobra.Command{
Use: "validate",
Short: "Validate assets",
Run: func(cmd *cobra.Command, args []string) {
gqlEndpoint := os.Getenv("HASURA_GRAPHQL_ENDPOINT")
if len(gqlEndpoint) == 0 {
fmt.Println("please set HASURA_GRAPHQL_ENDPOINT env var")
os.Exit(1)
return
}
if !strings.HasSuffix(gqlEndpoint, "/v1/graphql") {
gqlEndpoint = gqlEndpoint + "/v1/graphql"
}
// gqlEndpoint := os.Getenv("HASURA_GRAPHQL_ENDPOINT")
// if len(gqlEndpoint) == 0 {
// fmt.Println("please set HASURA_GRAPHQL_ENDPOINT env var")
// os.Exit(1)
// return
// }
// if !strings.HasSuffix(gqlEndpoint, "/v1/graphql") {
// gqlEndpoint = gqlEndpoint + "/v1/graphql"
// }

gqlAdminSecret := os.Getenv("HASURA_GRAPHQL_ADMIN_SECRET")
if len(gqlAdminSecret) == 0 {
fmt.Println("please set HASURA_GRAPHQL_ADMIN_SECRET env var")
os.Exit(1)
return
}
// gqlAdminSecret := os.Getenv("HASURA_GRAPHQL_ADMIN_SECRET")
// if len(gqlAdminSecret) == 0 {
// fmt.Println("please set HASURA_GRAPHQL_ADMIN_SECRET env var")
// os.Exit(1)
// return
// }

// gqlClient := graphql.NewClient(gqlEndpoint)
// connectorsInDB, err := gqldata.GetConnectors(context.Background(), gqlClient, gqlAdminSecret)
Expand Down

0 comments on commit 3630d34

Please sign in to comment.