Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb408bf2

Browse files
Fix: skip paths check on tag push events in workflows (#34602)
## SummaryFix skipping of `paths` condition in workflows triggered by tag pushevents.## Details- Ensure workflows triggered by tag pushes bypass the `paths` filtercheck.- Prevent incorrect skipping of workflows due to `paths` conditions ontag pushes.- Added and updated unit tests to verify correct behavior.
1 parentc6b2cbd commitb408bf2

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

‎modules/actions/workflows.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
313313
matchTimes++
314314
}
315315
case"paths":
316+
ifrefName.IsTag() {
317+
matchTimes++
318+
break
319+
}
316320
filesChanged,err:=commit.GetFilesChangedSinceCommit(pushPayload.Before)
317321
iferr!=nil {
318322
log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v",commit.ID.String(),err)
@@ -326,6 +330,10 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
326330
}
327331
}
328332
case"paths-ignore":
333+
ifrefName.IsTag() {
334+
matchTimes++
335+
break
336+
}
329337
filesChanged,err:=commit.GetFilesChangedSinceCommit(pushPayload.Before)
330338
iferr!=nil {
331339
log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v",commit.ID.String(),err)

‎modules/actions/workflows_test.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,24 @@ func TestDetectMatched(t *testing.T) {
125125
yamlOn:"on: schedule",
126126
expected:true,
127127
},
128+
{
129+
desc:"push to tag matches workflow with paths condition (should skip paths check)",
130+
triggedEvent:webhook_module.HookEventPush,
131+
payload:&api.PushPayload{
132+
Ref:"refs/tags/v1.0.0",
133+
Before:"0000000",
134+
Commits: []*api.PayloadCommit{
135+
{
136+
ID:"abcdef123456",
137+
Added: []string{"src/main.go"},
138+
Message:"Release v1.0.0",
139+
},
140+
},
141+
},
142+
commit:nil,
143+
yamlOn:"on:\n push:\n paths:\n - src/**",
144+
expected:true,
145+
},
128146
}
129147

130148
for_,tc:=rangetestCases {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp