Skip to content

Commit 52833e7

Browse files
authored
Merge branch 'main' into support-actions-concurrency
2 parents 28a5fe7 + 2d7e6e9 commit 52833e7

File tree

17 files changed

+239
-16
lines changed

17 files changed

+239
-16
lines changed

models/actions/run_job.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,25 @@ func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, col
159159
}
160160

161161
func AggregateJobStatus(jobs []*ActionRunJob) Status {
162-
allSuccessOrSkipped := true
163-
var hasFailure, hasCancelled, hasSkipped, hasWaiting, hasRunning, hasBlocked bool
162+
allSuccessOrSkipped := len(jobs) != 0
163+
allSkipped := len(jobs) != 0
164+
var hasFailure, hasCancelled, hasWaiting, hasRunning, hasBlocked bool
164165
for _, job := range jobs {
165166
allSuccessOrSkipped = allSuccessOrSkipped && (job.Status == StatusSuccess || job.Status == StatusSkipped)
167+
allSkipped = allSkipped && job.Status == StatusSkipped
166168
hasFailure = hasFailure || job.Status == StatusFailure
167169
hasCancelled = hasCancelled || job.Status == StatusCancelled
168-
hasSkipped = hasSkipped || job.Status == StatusSkipped
169170
hasWaiting = hasWaiting || job.Status == StatusWaiting
170171
hasRunning = hasRunning || job.Status == StatusRunning
171172
hasBlocked = hasBlocked || job.Status == StatusBlocked
172173
}
173174
switch {
175+
case allSkipped:
176+
return StatusSkipped
174177
case allSuccessOrSkipped:
175178
return StatusSuccess
179+
case hasCancelled:
180+
return StatusCancelled
176181
case hasFailure:
177182
return StatusFailure
178183
case hasRunning:
@@ -181,10 +186,6 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status {
181186
return StatusWaiting
182187
case hasBlocked:
183188
return StatusBlocked
184-
case hasCancelled:
185-
return StatusCancelled
186-
case hasSkipped:
187-
return StatusSkipped
188189
default:
189190
return StatusUnknown // it shouldn't happen
190191
}

models/actions/run_job_status_test.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
func TestAggregateJobStatus(t *testing.T) {
1313
testStatuses := func(expected Status, statuses []Status) {
14+
t.Helper()
1415
var jobs []*ActionRunJob
1516
for _, v := range statuses {
1617
jobs = append(jobs, &ActionRunJob{Status: v})
@@ -29,6 +30,16 @@ func TestAggregateJobStatus(t *testing.T) {
2930
statuses []Status
3031
expected Status
3132
}{
33+
// unknown cases, maybe it shouldn't happen in real world
34+
{[]Status{}, StatusUnknown},
35+
{[]Status{StatusUnknown, StatusSuccess}, StatusUnknown},
36+
{[]Status{StatusUnknown, StatusSkipped}, StatusUnknown},
37+
{[]Status{StatusUnknown, StatusFailure}, StatusFailure},
38+
{[]Status{StatusUnknown, StatusCancelled}, StatusCancelled},
39+
{[]Status{StatusUnknown, StatusWaiting}, StatusWaiting},
40+
{[]Status{StatusUnknown, StatusRunning}, StatusRunning},
41+
{[]Status{StatusUnknown, StatusBlocked}, StatusBlocked},
42+
3243
// success with other status
3344
{[]Status{StatusSuccess}, StatusSuccess},
3445
{[]Status{StatusSuccess, StatusSkipped}, StatusSuccess}, // skipped doesn't affect success
@@ -38,18 +49,28 @@ func TestAggregateJobStatus(t *testing.T) {
3849
{[]Status{StatusSuccess, StatusRunning}, StatusRunning},
3950
{[]Status{StatusSuccess, StatusBlocked}, StatusBlocked},
4051

52+
// any cancelled, then cancelled
53+
{[]Status{StatusCancelled}, StatusCancelled},
54+
{[]Status{StatusCancelled, StatusSuccess}, StatusCancelled},
55+
{[]Status{StatusCancelled, StatusSkipped}, StatusCancelled},
56+
{[]Status{StatusCancelled, StatusFailure}, StatusCancelled},
57+
{[]Status{StatusCancelled, StatusWaiting}, StatusCancelled},
58+
{[]Status{StatusCancelled, StatusRunning}, StatusCancelled},
59+
{[]Status{StatusCancelled, StatusBlocked}, StatusCancelled},
60+
4161
// failure with other status, fail fast
4262
// Should "running" win? Maybe no: old code does make "running" win, but GitHub does fail fast.
4363
{[]Status{StatusFailure}, StatusFailure},
4464
{[]Status{StatusFailure, StatusSuccess}, StatusFailure},
4565
{[]Status{StatusFailure, StatusSkipped}, StatusFailure},
46-
{[]Status{StatusFailure, StatusCancelled}, StatusFailure},
66+
{[]Status{StatusFailure, StatusCancelled}, StatusCancelled},
4767
{[]Status{StatusFailure, StatusWaiting}, StatusFailure},
4868
{[]Status{StatusFailure, StatusRunning}, StatusFailure},
4969
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},
5070

5171
// skipped with other status
52-
{[]Status{StatusSkipped}, StatusSuccess},
72+
// "all skipped" is also considered as "mergeable" by "services/actions.toCommitStatus", the same as GitHub
73+
{[]Status{StatusSkipped}, StatusSkipped},
5374
{[]Status{StatusSkipped, StatusSuccess}, StatusSuccess},
5475
{[]Status{StatusSkipped, StatusFailure}, StatusFailure},
5576
{[]Status{StatusSkipped, StatusCancelled}, StatusCancelled},

modules/markup/markdown/markdown.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ func SpecializedMarkdown(ctx *markup.RenderContext) *GlodmarkRender {
129129
Enabled: setting.Markdown.EnableMath,
130130
ParseDollarInline: true,
131131
ParseDollarBlock: true,
132-
ParseSquareBlock: true, // TODO: this is a bad syntax, it should be deprecated in the future (by some config options)
132+
ParseSquareBlock: true, // TODO: this is a bad syntax "\[ ... \]", it conflicts with normal markdown escaping, it should be deprecated in the future (by some config options)
133+
// ParseBracketInline: true, // TODO: this is also a bad syntax "\( ... \)", it also conflicts, it should be deprecated in the future
133134
}),
134135
meta.Meta,
135136
),

modules/repository/fork.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
"code.gitea.io/gitea/modules/setting"
1313
)
1414

15+
// CanUserForkBetweenOwners returns true if user can fork between owners.
16+
// By default, a user can fork a repository from another owner, but not from themselves.
17+
// Many users really like to fork their own repositories, so add an experimental setting to allow this.
1518
func CanUserForkBetweenOwners(id1, id2 int64) bool {
1619
if id1 != id2 {
1720
return true

options/locale/locale_fr-FR.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,6 @@ issues.timetracker_timer_stop=Arrêter le minuteur
16761676
issues.timetracker_timer_discard=Annuler le minuteur
16771677
issues.timetracker_timer_manually_add=Pointer du temps
16781678
1679-
issues.time_estimate_placeholder=1h 2m
16801679
issues.time_estimate_set=Définir le temps estimé
16811680
issues.time_estimate_display=Estimation : %s
16821681
issues.change_time_estimate_at=a changé le temps estimé à <b>%s</b> %s

options/locale/locale_ga-IE.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,6 @@ issues.timetracker_timer_stop=Stop an t-amadóir
16761676
issues.timetracker_timer_discard=Déan an t-amadóir a scriosadh
16771677
issues.timetracker_timer_manually_add=Cuir Am leis
16781678

1679-
issues.time_estimate_placeholder=1u 2n
16801679
issues.time_estimate_set=Socraigh am measta
16811680
issues.time_estimate_display=Meastachán: %s
16821681
issues.change_time_estimate_at=d'athraigh an meastachán ama go <b>%s</b> %s

options/locale/locale_pt-PT.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,6 @@ issues.timetracker_timer_stop=Parar cronómetro
16791679
issues.timetracker_timer_discard=Descartar cronómetro
16801680
issues.timetracker_timer_manually_add=Adicionar tempo
16811681

1682-
issues.time_estimate_placeholder=1h 2m
16831682
issues.time_estimate_set=Definir tempo estimado
16841683
issues.time_estimate_display=Estimativa: %s
16851684
issues.change_time_estimate_at=alterou a estimativa de tempo para <b>%s</b> %s
@@ -2632,6 +2631,7 @@ release.new_release=Novo lançamento
26322631
release.draft=Rascunho
26332632
release.prerelease=Pré-lançamento
26342633
release.stable=Estável
2634+
release.latest=Mais recente
26352635
release.compare=Comparar
26362636
release.edit=editar
26372637
release.ahead.commits=<strong>%d</strong> cometimentos

0 commit comments

Comments
 (0)