Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into usefetch
Browse files Browse the repository at this point in the history
* origin/main: (53 commits)
  Search branches (go-gitea#27055)
  Fix wrong migration for email address (go-gitea#27106)
  [skip ci] Updated translations via Crowdin
  Support `.git-blame-ignore-revs` file (go-gitea#26395)
  Add `RemoteAddress` to mirrors (go-gitea#26952)
  Upgrading the actions/checkout@4 (go-gitea#27096)
  Next round of `db.DefaultContext` refactor (go-gitea#27089)
  Ui correction in mobile view nav bar left aligned items. (go-gitea#27046)
  Add missing deps to files-changed (go-gitea#27100)
  Use db.WithTx for AddTeamMember to avoid ctx abuse (go-gitea#27095)
  Drop Node.js 16 and update js dependencies (go-gitea#27094)
  Fix NPE when editing OAuth2 applications (go-gitea#27078)
  Use `print` instead of `printf` (go-gitea#27093)
  Add tests for db indexer in indexer_test.go (go-gitea#27087)
  [skip ci] Updated translations via Crowdin
  Allow empty Conan files (go-gitea#27092)
  Actions are no longer experimental, so enable them by default (go-gitea#27054)
  Update brew installation documentation since gitea moved to brew core package (go-gitea#27070)
  More refactoring of `db.DefaultContext` (go-gitea#27083)
  [skip ci] Updated translations via Crowdin
  ...
  • Loading branch information
silverwind committed Sep 17, 2023
2 parents 1c1407d + 47b8788 commit 8a6e43c
Show file tree
Hide file tree
Showing 472 changed files with 4,365 additions and 2,869 deletions.
4 changes: 4 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
self-hosted-runner:
labels:
- actuated-4cpu-8gb
- actuated-4cpu-16gb
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ kind/build:

theme/package-registry:
- "modules/packages/**"
- "services/packages/**"
- "routers/api/packages/**"
- "routers/web/shared/packages/**"

kind/cli:
- "cmd/**"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cron-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'go-gitea/gitea'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cron-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'go-gitea/gitea'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: download from crowdin
uses: docker://jonasfranz/crowdin
env:
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'go-gitea/gitea'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: push translations to crowdin
uses: docker://jonasfranz/crowdin
env:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/files-changed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
swagger: ${{ steps.changes.outputs.swagger }}
yaml: ${{ steps.changes.outputs.yaml }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
Expand Down Expand Up @@ -64,9 +64,12 @@ jobs:
- "**/*.md"
- "docs/**"
- ".markdownlint.yaml"
- "package.json"
- "package-lock.json"
actions:
- ".github/workflows/*"
- "Makefile"
templates:
- "templates/**/*.tmpl"
Expand All @@ -90,3 +93,5 @@ jobs:
- "**/*.yml"
- "**/*.yaml"
- ".yamllint.yaml"
- "pyproject.toml"
- "poetry.lock"
22 changes: 11 additions & 11 deletions .github/workflows/pull-compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand All @@ -31,7 +31,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand All @@ -44,7 +44,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.11"
Expand All @@ -57,7 +57,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
Expand All @@ -69,7 +69,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand All @@ -86,7 +86,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand All @@ -101,7 +101,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand All @@ -114,7 +114,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
Expand All @@ -129,7 +129,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
Expand All @@ -174,6 +174,6 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- run: make lint-actions
12 changes: 6 additions & 6 deletions .github/workflows/pull-db-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
ports:
- "9000:9000"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand All @@ -63,7 +63,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
ports:
- "9000:9000"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
- "587:587"
- "993:993"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down Expand Up @@ -210,7 +210,7 @@ jobs:
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
ports:
- "1433:1433"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
needs: files-changed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
Expand Down
50 changes: 45 additions & 5 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ on:
push:
branches: [ main, release/v* ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
nightly-binary:
runs-on: ubuntu-latest
runs-on: actuated-4cpu-16gb
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
Expand Down Expand Up @@ -51,13 +55,17 @@ jobs:
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: dist/release
DEST_DIR: gitea/${{ steps.clean_name.outputs.branch }}
nightly-docker:
runs-on: ubuntu-latest
nightly-docker-rootful:
runs-on: actuated-4cpu-16gb
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
check-latest: true
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Get cleaned branch name
Expand All @@ -75,13 +83,45 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: fetch go modules
run: make vendor
- name: build rootful docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
nightly-docker-rootless:
runs-on: actuated-4cpu-16gb
steps:
- uses: actions/checkout@v4
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v4
with:
go-version: "~1.21"
check-latest: true
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Get cleaned branch name
id: clean_name
run: |
# if main then say nightly otherwise cleanup name
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "branch=nightly" >> "$GITHUB_OUTPUT"
exit 0
fi
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: fetch go modules
run: make vendor
- name: build rootless docker image
uses: docker/build-push-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ cpu.out
/.go-licenses

# Snapcraft
/gitea_a*.txt
snap/.snapcraft/
parts/
stage/
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ Denys Konovalov <kontakt@denyskon.de> (@denyskon)
Punit Inani <punitinani1@gmail.com> (@puni9869)
CaiCandong <1290147055@qq.com> (@caicandong)
Rui Chen <rui@chenrui.dev> (@chenrui333)
Nanguan Lin <nanguanlin6@gmail.com> (@lng2020)
6 changes: 3 additions & 3 deletions cmd/admin_user_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func runCreateUser(c *cli.Context) error {

// If this is the first user being created.
// Take it as the admin and don't force a password update.
if n := user_model.CountUsers(nil); n == 0 {
if n := user_model.CountUsers(ctx, nil); n == 0 {
changePassword = false
}

Expand Down Expand Up @@ -146,7 +146,7 @@ func runCreateUser(c *cli.Context) error {
IsRestricted: restricted,
}

if err := user_model.CreateUser(u, overwriteDefault); err != nil {
if err := user_model.CreateUser(ctx, u, overwriteDefault); err != nil {
return fmt.Errorf("CreateUser: %w", err)
}

Expand All @@ -156,7 +156,7 @@ func runCreateUser(c *cli.Context) error {
UID: u.ID,
}

if err := auth_model.NewAccessToken(t); err != nil {
if err := auth_model.NewAccessToken(ctx, t); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/admin_user_generate_access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func runGenerateAccessToken(c *cli.Context) error {
UID: user.ID,
}

exist, err := auth_model.AccessTokenByNameExists(t)
exist, err := auth_model.AccessTokenByNameExists(ctx, t)
if err != nil {
return err
}
Expand All @@ -79,7 +79,7 @@ func runGenerateAccessToken(c *cli.Context) error {
t.Scope = accessTokenScope

// create the token
if err := auth_model.NewAccessToken(t); err != nil {
if err := auth_model.NewAccessToken(ctx, t); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/admin_user_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func runListUsers(c *cli.Context) error {
return err
}

users, err := user_model.GetAllUsers()
users, err := user_model.GetAllUsers(ctx)
if err != nil {
return err
}
Expand All @@ -48,7 +48,7 @@ func runListUsers(c *cli.Context) error {
}
}
} else {
twofa := user_model.UserList(users).GetTwoFaStatus()
twofa := user_model.UserList(users).GetTwoFaStatus(ctx)
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\t2FA\n")
for _, u := range users {
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin, twofa[u.ID])
Expand Down
Loading

0 comments on commit 8a6e43c

Please sign in to comment.