Skip to content

Commit 197612e

Browse files
authored
Merge branch 'main' into rb/minio-credentials-chain
2 parents 86d3f62 + 7ab0988 commit 197612e

File tree

8 files changed

+126
-9
lines changed

8 files changed

+126
-9
lines changed

.github/workflows/release-nightly.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
run: |
4848
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
4949
echo "Cleaned name is ${REF_NAME}"
50-
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
50+
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
5151
- name: configure aws
5252
uses: aws-actions/configure-aws-credentials@v4
5353
with:

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.22-alpine3.19 AS build-env
2+
FROM docker.io/library/golang:1.22-alpine3.20 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -41,7 +41,7 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \
4141
/go/src/code.gitea.io/gitea/environment-to-ini
4242
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
4343

44-
FROM docker.io/library/alpine:3.19
44+
FROM docker.io/library/alpine:3.20
4545
LABEL maintainer="[email protected]"
4646

4747
EXPOSE 22 3000

Dockerfile.rootless

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.22-alpine3.19 AS build-env
2+
FROM docker.io/library/golang:1.22-alpine3.20 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -39,7 +39,7 @@ RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
3939
/go/src/code.gitea.io/gitea/environment-to-ini
4040
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
4141

42-
FROM docker.io/library/alpine:3.19
42+
FROM docker.io/library/alpine:3.20
4343
LABEL maintainer="[email protected]"
4444

4545
EXPOSE 2222 3000

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ifneq ($(GITHUB_REF_TYPE),branch)
8888
GITEA_VERSION ?= $(VERSION)
8989
else
9090
ifneq ($(GITHUB_REF_NAME),)
91-
VERSION ?= $(subst release/v,,$(GITHUB_REF_NAME))
91+
VERSION ?= $(subst release/v,,$(GITHUB_REF_NAME))-nightly
9292
else
9393
VERSION ?= main
9494
endif

modules/issue/template/template.go

+25
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ func validateYaml(template *api.IssueTemplate) error {
9191
if err := validateOptions(field, idx); err != nil {
9292
return err
9393
}
94+
if err := validateDropdownDefault(position, field.Attributes); err != nil {
95+
return err
96+
}
9497
case api.IssueFormFieldTypeCheckboxes:
9598
if err := validateStringItem(position, field.Attributes, false, "description"); err != nil {
9699
return err
@@ -249,6 +252,28 @@ func validateBoolItem(position errorPosition, m map[string]any, names ...string)
249252
return nil
250253
}
251254

255+
func validateDropdownDefault(position errorPosition, attributes map[string]any) error {
256+
v, ok := attributes["default"]
257+
if !ok {
258+
return nil
259+
}
260+
defaultValue, ok := v.(int)
261+
if !ok {
262+
return position.Errorf("'default' should be an int")
263+
}
264+
265+
options, ok := attributes["options"].([]any)
266+
if !ok {
267+
// should not happen
268+
return position.Errorf("'options' is required and should be a array")
269+
}
270+
if defaultValue < 0 || defaultValue >= len(options) {
271+
return position.Errorf("the value of 'default' is out of range")
272+
}
273+
274+
return nil
275+
}
276+
252277
type errorPosition string
253278

254279
func (p errorPosition) Errorf(format string, a ...any) error {

modules/issue/template/template_test.go

+92
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,96 @@ body:
355355
`,
356356
wantErr: "body[0](checkboxes), option[1]: can not require a hidden checkbox",
357357
},
358+
{
359+
name: "dropdown default is not an integer",
360+
content: `
361+
name: "test"
362+
about: "this is about"
363+
body:
364+
- type: dropdown
365+
id: "1"
366+
attributes:
367+
label: Label of dropdown
368+
description: Description of dropdown
369+
multiple: true
370+
options:
371+
- Option 1 of dropdown
372+
- Option 2 of dropdown
373+
- Option 3 of dropdown
374+
default: "def"
375+
validations:
376+
required: true
377+
`,
378+
wantErr: "body[0](dropdown): 'default' should be an int",
379+
},
380+
{
381+
name: "dropdown default is out of range",
382+
content: `
383+
name: "test"
384+
about: "this is about"
385+
body:
386+
- type: dropdown
387+
id: "1"
388+
attributes:
389+
label: Label of dropdown
390+
description: Description of dropdown
391+
multiple: true
392+
options:
393+
- Option 1 of dropdown
394+
- Option 2 of dropdown
395+
- Option 3 of dropdown
396+
default: 3
397+
validations:
398+
required: true
399+
`,
400+
wantErr: "body[0](dropdown): the value of 'default' is out of range",
401+
},
402+
{
403+
name: "dropdown without default is valid",
404+
content: `
405+
name: "test"
406+
about: "this is about"
407+
body:
408+
- type: dropdown
409+
id: "1"
410+
attributes:
411+
label: Label of dropdown
412+
description: Description of dropdown
413+
multiple: true
414+
options:
415+
- Option 1 of dropdown
416+
- Option 2 of dropdown
417+
- Option 3 of dropdown
418+
validations:
419+
required: true
420+
`,
421+
want: &api.IssueTemplate{
422+
Name: "test",
423+
About: "this is about",
424+
Fields: []*api.IssueFormField{
425+
{
426+
Type: "dropdown",
427+
ID: "1",
428+
Attributes: map[string]any{
429+
"label": "Label of dropdown",
430+
"description": "Description of dropdown",
431+
"multiple": true,
432+
"options": []any{
433+
"Option 1 of dropdown",
434+
"Option 2 of dropdown",
435+
"Option 3 of dropdown",
436+
},
437+
},
438+
Validations: map[string]any{
439+
"required": true,
440+
},
441+
Visible: []api.IssueFormFieldVisible{api.IssueFormFieldVisibleForm, api.IssueFormFieldVisibleContent},
442+
},
443+
},
444+
FileName: "test.yaml",
445+
},
446+
wantErr: "",
447+
},
358448
{
359449
name: "valid",
360450
content: `
@@ -399,6 +489,7 @@ body:
399489
- Option 1 of dropdown
400490
- Option 2 of dropdown
401491
- Option 3 of dropdown
492+
default: 1
402493
validations:
403494
required: true
404495
- type: checkboxes
@@ -475,6 +566,7 @@ body:
475566
"Option 2 of dropdown",
476567
"Option 3 of dropdown",
477568
},
569+
"default": 1,
478570
},
479571
Validations: map[string]any{
480572
"required": true,

options/locale/locale_pt-PT.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -798,9 +798,9 @@ manage_ssh_keys=Gerir chaves SSH
798798
manage_ssh_principals=Gerir Protagonistas de Certificados SSH
799799
manage_gpg_keys=Gerir chaves GPG
800800
add_key=Adicionar chave
801-
ssh_desc=Essas chaves públicas SSH estão associadas à sua conta. As chaves privadas correspondentes permitem acesso total aos seus repositórios.
801+
ssh_desc=Estas chaves públicas SSH estão associadas à sua conta. As chaves privadas correspondentes permitem acesso total aos seus repositórios.
802802
principal_desc=Estes protagonistas de certificados SSH estão associados à sua conta e permitem acesso total aos seus repositórios.
803-
gpg_desc=Essas chaves GPG públicas estão associadas à sua conta. Mantenha as suas chaves privadas seguras, uma vez que elas permitem a validação dos cometimentos.
803+
gpg_desc=Estas chaves GPG públicas estão associadas à sua conta. Mantenha as suas chaves privadas seguras, uma vez que elas permitem a validação dos cometimentos.
804804
ssh_helper=<strong>Precisa de ajuda?</strong> Dê uma vista de olhos no guia do GitHub para <a href="%s">criar as suas próprias chaves SSH</a> ou para resolver <a href="%s">problemas comuns</a> que pode encontrar ao usar o SSH.
805805
gpg_helper=<strong>Precisa de ajuda?</strong> Dê uma vista de olhos no guia do GitHub <a href="%s">sobre GPG</a>.
806806
add_new_key=Adicionar Chave SSH

templates/repo/issue/fields/dropdown.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{template "repo/issue/fields/header" .}}
33
{{/* FIXME: required validation */}}
44
<div class="ui fluid selection dropdown {{if .item.Attributes.multiple}}multiple clearable{{end}}">
5-
<input type="hidden" name="form-field-{{.item.ID}}" value="0">
5+
<input type="hidden" name="form-field-{{.item.ID}}" value="{{.item.Attributes.default}}">
66
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
77
{{if not .item.Validations.required}}
88
{{svg "octicon-x" 14 "remove icon"}}

0 commit comments

Comments
 (0)