Skip to content

Commit

Permalink
ci(cache): added cache to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tnfssc committed Aug 15, 2024
1 parent c266dfa commit ec7220b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,22 @@ jobs:
- uses: actions/checkout@v4

- name: Cache asdf
id: cache-asdf
uses: actions/cache@v4
env:
cache-name: cache-asdf
with:
path: ~/.asdf
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/.tool-versions') }}
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
${{ runner.os }}-asdf-
- name: Cache golang
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install asdf & tools
uses: asdf-vm/actions/install@v3
Expand Down
14 changes: 10 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"runtime"
"strings"

"github.com/atotto/clipboard"
Expand All @@ -24,16 +25,21 @@ func main() {

apiKey := os.Getenv("GROQ_API_KEY")
if apiKey == "" {
log.Fatal().Msg("GROQ_API_KEY is not set")
log.Fatal().Msg("GROQ_API_KEY is not set. Get one from https://console.groq.com/keys.")
}
shell := os.Getenv("SHELL")
if shell == "" {
log.Fatal().Msg("SHELL is not set")
log.Fatal().Msg("Could not determine shell. Set SHELL environment variable.")
}
_shell := strings.Split(shell, "/")
shell = _shell[len(_shell)-1]

kernel := runtime.GOOS

prompt := fmt.Sprintf(`Only reply with the single line command surrounded by three backticks. It must be able to be directly run in the target shell. Do not include any other text.
Make sure the command runs on %s shell.
The prompt: %s`, shell, strings.Join(os.Args[1:], " "))
Make sure the command runs on %s shell on %s kernel.
The prompt: %s`, shell, kernel, strings.Join(os.Args[1:], " "))
log.Debug().Msg(prompt)

llm, err := openai.New(
openai.WithModel("gemma2-9b-it"),
Expand Down

0 comments on commit ec7220b

Please sign in to comment.