diff --git a/.github/workflows/frogbot-scan-pull-request.yml b/.github/workflows/frogbot-scan-pull-request.yml index 50a00670f..a3bd2afd8 100644 --- a/.github/workflows/frogbot-scan-pull-request.yml +++ b/.github/workflows/frogbot-scan-pull-request.yml @@ -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 diff --git a/artifactory/utils/commandsummary/buildinfosummary_test.go b/artifactory/utils/commandsummary/buildinfosummary_test.go index e7f31a64d..c1e927682 100644 --- a/artifactory/utils/commandsummary/buildinfosummary_test.go +++ b/artifactory/utils/commandsummary/buildinfosummary_test.go @@ -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{ diff --git a/artifactory/utils/commandsummary/utils_test.go b/artifactory/utils/commandsummary/utils_test.go index 3799ac215..0b2d49a10 100644 --- a/artifactory/utils/commandsummary/utils_test.go +++ b/artifactory/utils/commandsummary/utils_test.go @@ -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