Skip to content

Commit 0bf85fc

Browse files
committed
Fix actions of fork PRs
1 parent 678250a commit 0bf85fc

File tree

8 files changed

+75
-11
lines changed

8 files changed

+75
-11
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
open-pull-requests-limit: 10
88
groups:
99
go:
10+
update-types:
11+
- minor
12+
- patch
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"
17+
open-pull-requests-limit: 5
18+
groups:
19+
github-actions:
1020
update-types:
1121
- minor
1222
- patch

.github/workflows/analysis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
steps:
1616
- name: Checkout Source
1717
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.pull_request.head.sha }}
1820

1921
- name: Setup Go with cache
2022
uses: jfrog/.github/actions/install-go-with-cache@main
@@ -27,6 +29,9 @@ jobs:
2729
steps:
2830
- name: Checkout Source
2931
uses: actions/checkout@v4
32+
with:
33+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
34+
fetch-depth: 0
3035

3136
- name: Setup Go with cache
3237
uses: jfrog/.github/actions/install-go-with-cache@main
@@ -39,6 +44,9 @@ jobs:
3944
steps:
4045
- name: Checkout Source
4146
uses: actions/checkout@v4
47+
with:
48+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
49+
fetch-depth: 0
4250

4351
- name: Check for uncommented replace instructions
4452
run: |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Dependabot auto-merge
2+
on:
3+
pull_request_target:
4+
branches:
5+
- master
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
dependabot:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'jfrog/jfrog-cli-core'
15+
steps:
16+
- name: Dependabot metadata
17+
id: metadata
18+
uses: dependabot/[email protected]
19+
with:
20+
github-token: "${{ secrets.GITHUB_TOKEN }}"
21+
- name: Enable auto-merge for Dependabot PRs
22+
run: gh pr merge --auto --squash "$PR_URL"
23+
env:
24+
PR_URL: ${{github.event.pull_request.html_url}}
25+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/frogbot-scan-repository.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
# [Optional]
122122
# Set the minimum severity for vulnerabilities that should be fixed and commented on in pull requests
123123
# The following values are accepted: Low, Medium, High or Critical
124-
# JF_MIN_SEVERITY: ""
124+
JF_MIN_SEVERITY: "High"
125125

126126
# [Optional, Default: [email protected]]
127127
# Set the email of the commit author

.github/workflows/monitor-stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
permissions:
1515
issues: write
1616
steps:
17-
- uses: actions/stale@v9
17+
- uses: actions/stale@v10
1818
with:
1919
# Ignore issues with these labels
2020
exempt-issue-labels: "feature request,question"

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ jobs:
2121
GRADLE_OPTS: -Dorg.gradle.daemon=false
2222
JFROG_CLI_LOG_LEVEL: "DEBUG"
2323
steps:
24-
- uses: actions/checkout@v4
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
2528

2629
- name: Setup Python3
2730
uses: actions/setup-python@v5

artifactory/utils/maven/settingsxml.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ func createNewDeploymentProfile(altDeploymentRepo string) maven.Profile {
133133
// configureArtifactoryDeployment configures Maven to deploy/push artifacts to Artifactory by default
134134
// This adds a profile with altDeploymentRepository properties that override any pom.xml distributionManagement
135135
// Uses the same server credentials as the mirror configuration (artifactory-mirror)
136+
//
137+
//nolint:unparam
136138
func (sxm *SettingsXmlManager) configureArtifactoryDeployment(repoUrl string) error {
137139
// Build the altDeploymentRepository string for Maven Deploy Plugin
138140
// Source: apache/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java
@@ -219,6 +221,8 @@ func (sxm *SettingsXmlManager) updateMirror(repoUrl, repoName string) error {
219221
}
220222

221223
// updateServerCredentials updates or adds server credentials in the settings.
224+
//
225+
//nolint:unparam
222226
func (sxm *SettingsXmlManager) updateServerCredentials(username, password string) error {
223227
// Create the new server with the provided credentials
224228
updatedServer := mavenv1.Server{
@@ -256,12 +260,12 @@ func (sxm *SettingsXmlManager) writeSettingsToFile() error {
256260

257261
// Add XML header and write to file
258262
data = append([]byte(xml.Header), data...)
259-
err = os.MkdirAll(filepath.Dir(sxm.path), 0755)
263+
err = os.MkdirAll(filepath.Dir(sxm.path), 0o755)
260264
if err != nil {
261265
return fmt.Errorf("failed to create directory for settings file: %w", err)
262266
}
263267

264-
err = os.WriteFile(sxm.path, data, 0644)
268+
err = os.WriteFile(sxm.path, data, 0o644)
265269
if err != nil {
266270
return fmt.Errorf("failed to write settings to file %s: %w", sxm.path, err)
267271
}

artifactory/utils/maven/settingsxml_test.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
1212
"github.com/apache/camel-k/v2/pkg/util/maven"
1313
"github.com/stretchr/testify/assert"
14+
"github.com/stretchr/testify/require"
1415
)
1516

1617
// cleanupTempDir safely removes a temporary directory and checks for errors
@@ -27,8 +28,15 @@ func TestNewSettingsXmlManager(t *testing.T) {
2728

2829
// Set up a test home directory
2930
originalHome := os.Getenv("HOME")
30-
defer os.Setenv("HOME", originalHome)
31-
os.Setenv("HOME", tempDir)
31+
defer func() {
32+
err := os.Setenv("HOME", originalHome)
33+
if err != nil {
34+
t.Logf("Failed to set HOME environment variable: %v", err)
35+
}
36+
}()
37+
38+
err = os.Setenv("HOME", tempDir)
39+
require.NoError(t, err)
3240

3341
// Test with non-existing settings file
3442
manager, err := NewSettingsXmlManager()
@@ -79,7 +87,7 @@ func TestLoadSettings_ExistingFile(t *testing.T) {
7987
</mirrors>
8088
</settings>`
8189

82-
err = os.WriteFile(settingsPath, []byte(settingsContent), 0644)
90+
err = os.WriteFile(settingsPath, []byte(settingsContent), 0o644)
8391
assert.NoError(t, err, "Failed to write test settings file")
8492

8593
manager := &SettingsXmlManager{path: settingsPath}
@@ -310,8 +318,14 @@ func TestConfigureArtifactoryMirror_NoCredentials(t *testing.T) {
310318

311319
// Set up a test home directory
312320
originalHome := os.Getenv("HOME")
313-
defer os.Setenv("HOME", originalHome)
314-
os.Setenv("HOME", tempDir)
321+
defer func() {
322+
err := os.Setenv("HOME", originalHome)
323+
if err != nil {
324+
t.Logf("Failed to set HOME environment variable: %v", err)
325+
}
326+
}()
327+
err = os.Setenv("HOME", tempDir)
328+
require.NoError(t, err)
315329

316330
manager, err := NewSettingsXmlManager()
317331
assert.NoError(t, err, "Failed to create manager")
@@ -420,7 +434,7 @@ func TestDataPreservation_RoundTrip(t *testing.T) {
420434
</mirrors>
421435
</settings>`
422436

423-
err = os.WriteFile(settingsPath, []byte(originalContent), 0644)
437+
err = os.WriteFile(settingsPath, []byte(originalContent), 0o644)
424438
assert.NoError(t, err, "Failed to write original settings file")
425439

426440
// Load the settings

0 commit comments

Comments
 (0)