Skip to content

Commit

Permalink
fix: E2E with safedep API key
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisek committed Nov 12, 2024
1 parent 350ab78 commit 4e4302f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:
env:
E2E_INSIGHTS_V2: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This will not be available when there is a PR from a forked repository
SAFEDEP_CLOUD_API_KEY: ${{ secrets.SAFEDEP_CLOUD_API_KEY }}

build-container:
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions internal/connect/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ func GetGithubOAuth2ClientId() string {
}

func GetGithubClient() (*github.Client, error) {
github_token := os.Getenv("GITHUB_TOKEN")
if !utils.IsEmptyString(github_token) {
githubToken := os.Getenv("GITHUB_TOKEN")
if !utils.IsEmptyString(githubToken) {
logger.Debugf("Found GITHUB_TOKEN env variable, using it to access Github.")
} else {
github_token = globalConfig.GithubAccessToken
githubToken = globalConfig.GithubAccessToken
}

if utils.IsEmptyString(github_token) {
if utils.IsEmptyString(githubToken) {
rateLimitedClient, err := githubRateLimitedClient(http.DefaultTransport)
if err != nil {
return nil, err
Expand All @@ -56,7 +56,7 @@ func GetGithubClient() (*github.Client, error) {
}

tokenSource := oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: github_token,
AccessToken: githubToken,
})

baseClient := oauth2.NewClient(context.Background(), tokenSource)
Expand Down
2 changes: 1 addition & 1 deletion test/scenarios/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export E2E_ROOT="$E2E_THIS_DIR/../../"
export E2E_FIXTURES="$E2E_THIS_DIR/fixtures"
export E2E_VET_BINARY="$E2E_ROOT/vet"
export E2E_VET_INSIGHTS_V2="${E2E_INSIGHTS_V2:-false}"
export E2E_VET_SCAN_CMD="$E2E_VET_BINARY scan -s --no-banner --insights-v2 $E2E_VET_INSIGHTS_V2"
export E2E_VET_SCAN_CMD="$E2E_VET_BINARY scan -s --no-banner --insights-v2=$E2E_VET_INSIGHTS_V2"

bash $E2E_THIS_DIR/scenario-1-vet-scans-vet.sh
bash $E2E_THIS_DIR/scenario-2-vet-scan-demo-client-java.sh
Expand Down

0 comments on commit 4e4302f

Please sign in to comment.