Skip to content

Commit

Permalink
fix: remove hardcoded repository name
Browse files Browse the repository at this point in the history
  • Loading branch information
fallion committed Jun 17, 2020
1 parent 367f626 commit 134984f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
- run: go mod download
- name: Run Commitsar
run: go run main.go
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

golangci-lint:
name: runner / golangci-lint
Expand Down
9 changes: 8 additions & 1 deletion internal/root_runner/run_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"io/ioutil"
"log"
"strings"

"golang.org/x/oauth2"

Expand All @@ -18,6 +19,12 @@ import (
func (runner *Runner) RunPullRequest(jiraKeys []string) ([]string, error) {
ghToken := viper.GetString("GITHUB_TOKEN")

if !viper.IsSet("GITHUB_REPOSITORY") {
return nil, errors.New("missing GITHUB_REPOSITORY env variable. Please provide one in owner/repository format")
}

split := strings.Split(viper.GetString("GITHUB_REPOSITORY"), "/")

gitRepo, err := history.OpenGit(".", log.New(ioutil.Discard, "", 0))

if err != nil {
Expand All @@ -39,7 +46,7 @@ func (runner *Runner) RunPullRequest(jiraKeys []string) ([]string, error) {
return nil, err
}

prs, response, err := client.PullRequests.ListPullRequestsWithCommit(ctx, "aevea", "commitsar", currentCommit.Hash.String(), nil)
prs, response, err := client.PullRequests.ListPullRequestsWithCommit(ctx, split[0], split[1], currentCommit.Hash.String(), nil)

if err != nil {
return nil, err
Expand Down
2 changes: 2 additions & 0 deletions www/docs/usage/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ validate-commits:
ref: ${{ github.event.pull_request.head.sha }}
- name: Commitsar check
uses: docker://aevea/commitsar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

1 comment on commit 134984f

@vercel
Copy link

@vercel vercel bot commented on 134984f Jun 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.