Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/frogbot-scan-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
scan-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Setup Go with cache
uses: jfrog/.github/actions/install-go-with-cache@main

Expand Down
13 changes: 5 additions & 8 deletions artifactory/utils/commandsummary/buildinfosummary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ func (m *MockScanResult) GetVulnerabilities() string {
func prepareBuildInfoTest(t *testing.T) (*BuildInfoSummary, func()) {
// Set up test environment
originalWorkflow := os.Getenv(workflowEnvKey)
if originalWorkflow == "" {
// this make the test pass locally
err := os.Setenv(workflowEnvKey, "JFrog CLI Core Tests")
require.NoError(t, err)
t.Cleanup(func() {
_ = os.Setenv(workflowEnvKey, originalWorkflow)
})
}
err := os.Setenv(workflowEnvKey, "JFrog CLI Core Tests")
require.NoError(t, err)
t.Cleanup(func() {
_ = os.Setenv(workflowEnvKey, originalWorkflow)
})
// Mock the scan results defaults
StaticMarkdownConfig.scanResultsMapping = make(map[string]ScanResult)
StaticMarkdownConfig.scanResultsMapping[NonScannedResult] = &MockScanResult{
Expand Down
15 changes: 6 additions & 9 deletions artifactory/utils/commandsummary/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@ const (

func TestGenerateArtifactUrl(t *testing.T) {
// Set up test environment
originalWorklfow, exists := os.LookupEnv(workflowEnvKey)
if !exists {
// this make the test pass locally
err := os.Setenv(workflowEnvKey, "JFrog CLI Core Tests")
originalWorklfow := os.Getenv(workflowEnvKey)
err := os.Setenv(workflowEnvKey, "JFrog CLI Core Tests")
require.NoError(t, err)
t.Cleanup(func() {
err = os.Setenv(workflowEnvKey, originalWorklfow)
require.NoError(t, err)
t.Cleanup(func() {
err = os.Setenv(workflowEnvKey, originalWorklfow)
require.NoError(t, err)
})
}
})

cases := []struct {
testName string
Expand Down
Loading