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

fix: replace some git command invocations with go-git library #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
33 changes: 33 additions & 0 deletions .github/workflows/reviewdog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: reviewdog
on: [pull_request]

jobs:
reviewdog:
name: linters
runs-on: ubuntu-22.04
steps:
# UPDATE_HERE
# https://github.com/actions/checkout/releases
- name: check out code into the go module directory
uses: actions/checkout@v4

# UPDATE_HERE
# https://github.com/webfactory/ssh-agent/releases
- name: Configure SSH private key for private repos
uses: webfactory/[email protected]
with:
# AWS secret: storm/deploy-ssh-keys
ssh-private-key: |
${{ secrets.SSH_KEY }}

# UPDATE_HERE
# https://github.com/reviewdog/action-golangci-lint/releases
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--timeout=4m"

# UPDATE_HERE
# https://github.com/reviewdog/action-actionlint/releases
- name: action-lint
uses: reviewdog/action-actionlint@v1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ vet: ## Run go vet against code.

.PHONY: mockery
mockery: ## Regenerate mock files
for i in exec gitlab; do \
for i in exec gitlab gitget; do \
(cd $$i; rm -fr mocks; mockery --all) ;\
done

Expand Down
13 changes: 9 additions & 4 deletions exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ import (

const gitCmd = "git"

type ShellRunnerI interface {
ExecGitCommand(args []string, stdoutb *bytes.Buffer, erroutb *bytes.Buffer, dir string) (cmd *exec.Cmd, err error)
type GitRunnerI interface {
ExecGitCommand(
args []string,
stdoutb *bytes.Buffer,
erroutb *bytes.Buffer,
dir string,
) (cmd *exec.Cmd, err error)
}

type ShellRunner struct{}
type ShellGitRunner struct{}

// ExecGitCommand executes git with flags passed as `args` and can change working directory if `dir` is passed
func (repo *ShellRunner) ExecGitCommand(
func (repo *ShellGitRunner) ExecGitCommand(
args []string,
stdoutb *bytes.Buffer,
erroutb *bytes.Buffer,
Expand Down
14 changes: 7 additions & 7 deletions exec/mocks/ShellRunnerI.go → exec/mocks/GitRunnerI.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading