aboutsummaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDenys Konovalov <kontakt@denyskon.de>2024-03-14 04:18:04 +0100
committerGitHub <noreply@github.com>2024-03-14 03:18:04 +0000
commit7a90e5954f8515329f20ff0e391130e1ee7b8864 (patch)
treed9c4790ebeb8261c13cf9423a1570ff41e4fc262 /services
parente79a807a8461a73bd66146d816f635b66e198c89 (diff)
downloadgitea-7a90e5954f8515329f20ff0e391130e1ee7b8864.tar.gz
gitea-7a90e5954f8515329f20ff0e391130e1ee7b8864.zip
add skip ci support for pull request title (#29774)
Extends #28075 to support [skip ci] inside PR titles. Close #29265
Diffstat (limited to 'services')
-rw-r--r--services/actions/notifier_helper.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/services/actions/notifier_helper.go b/services/actions/notifier_helper.go
index d84191dca2..fafb6ab40e 100644
--- a/services/actions/notifier_helper.go
+++ b/services/actions/notifier_helper.go
@@ -157,7 +157,7 @@ func notify(ctx context.Context, input *notifyInput) error {
return fmt.Errorf("gitRepo.GetCommit: %w", err)
}
- if skipWorkflowsForCommit(input, commit) {
+ if skipWorkflows(input, commit) {
return nil
}
@@ -223,8 +223,8 @@ func notify(ctx context.Context, input *notifyInput) error {
return handleWorkflows(ctx, detectedWorkflows, commit, input, ref)
}
-func skipWorkflowsForCommit(input *notifyInput, commit *git.Commit) bool {
- // skip workflow runs with a configured skip-ci string in commit message if the event is push or pull_request(_sync)
+func skipWorkflows(input *notifyInput, commit *git.Commit) bool {
+ // skip workflow runs with a configured skip-ci string in commit message or pr title if the event is push or pull_request(_sync)
// https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
skipWorkflowEvents := []webhook_module.HookEventType{
webhook_module.HookEventPush,
@@ -233,6 +233,10 @@ func skipWorkflowsForCommit(input *notifyInput, commit *git.Commit) bool {
}
if slices.Contains(skipWorkflowEvents, input.Event) {
for _, s := range setting.Actions.SkipWorkflowStrings {
+ if input.PullRequest != nil && strings.Contains(input.PullRequest.Issue.Title, s) {
+ log.Debug("repo %s: skipped run for pr %v because of %s string", input.Repo.RepoPath(), input.PullRequest.Issue.ID, s)
+ return true
+ }
if strings.Contains(commit.CommitMessage, s) {
log.Debug("repo %s with commit %s: skipped run because of %s string", input.Repo.RepoPath(), commit.ID, s)
return true