diff --git a/.gitea/issue_template.md b/.gitea/issue_template.md deleted file mode 100644 index cf173a67ca..0000000000 --- a/.gitea/issue_template.md +++ /dev/null @@ -1,42 +0,0 @@ - - - - -- Gitea version (or commit ref): -- Git version: -- Operating system: - - - -- Database (use `[x]`): - - [ ] PostgreSQL - - [ ] MySQL - - [ ] MSSQL - - [ ] SQLite -- Can you reproduce the bug at https://demo.gitea.com: - - [ ] Yes (provide example URL) - - [ ] No -- Log gist: - - - - -## Description - - -... - - -## Screenshots - - diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index 4dbe1a4c56..e793e068bb 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -1,91 +1,28 @@ name: Bug Report -description: Found something you weren't expecting? Report it here! +description: Something isn't working as expected. labels: ["type/bug"] body: - type: markdown attributes: value: | - NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue. - - type: markdown - attributes: - value: | - 1. Please speak English, this is the language all maintainers can speak and write. - 2. Please ask questions or configuration/deploy problems on our Discord - server (https://discord.gg/gitea) or forum (https://forum.gitea.com). - 3. Make sure you are using the latest release and - take a moment to check that your issue hasn't been reported before. - 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq) - 5. It's really important to provide pertinent details and logs (https://docs.gitea.com/help/support), - incomplete details will be handled as an invalid report. - - type: textarea - id: description - attributes: - label: Description - description: | - Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below) - If you are using a proxy or a CDN (e.g. Cloudflare) in front of Gitea, please disable the proxy/CDN fully and access Gitea directly to confirm the issue still persists without those services. + - **Security issue?** Email security@gitea.io instead of opening a public issue. + - **Need help** with setup or configuration? Ask on [Discord](https://discord.gg/Gitea) or the [forum](https://forum.gitea.com). + - Search [existing issues](https://github.com/go-gitea/gitea/issues?q=is%3Aissue) first. - type: input id: gitea-ver attributes: label: Gitea Version - description: Gitea version (or commit reference) of your instance validations: required: true - - type: dropdown - id: can-reproduce + - type: textarea + id: description attributes: - label: Can you reproduce the bug on the Gitea demo site? - description: | - If so, please provide a URL in the Description field - URL of Gitea demo: https://demo.gitea.com - options: - - "Yes" - - "No" + label: What happened? + description: What you did, what you expected to happen, and what happened instead. Include logs if relevant. validations: required: true - - type: markdown - attributes: - value: | - It's really important to provide pertinent logs - Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help - In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini - - type: input - id: logs - attributes: - label: Log Gist - description: Please provide a gist URL of your logs, with any sensitive information (e.g. API keys) removed/hidden - type: textarea - id: screenshots - attributes: - label: Screenshots - description: If this issue involves the Web Interface, please provide one or more screenshots - - type: input - id: git-ver - attributes: - label: Git Version - description: The version of git running on the server - - type: input - id: os-ver - attributes: - label: Operating System - description: The operating system you are using to run Gitea - - type: textarea - id: run-info + id: environment attributes: label: How are you running Gitea? - description: | - Please include information on whether you built Gitea yourself, used one of our downloads, are using https://demo.gitea.com or are using some other package - Please also tell us how you are running Gitea, e.g. if it is being run from docker, a command-line, systemd etc. - If you are using a package or systemd tell us what distribution you are using - validations: - required: true - - type: dropdown - id: database - attributes: - label: Database - description: What database system are you running? - options: - - PostgreSQL - - MySQL/MariaDB - - MSSQL - - SQLite + description: Install method (binary, Docker, package), operating system, and database. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index d5c480d202..3ad0fb9e64 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -1,24 +1,20 @@ name: Feature Request -description: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here! +description: Suggest an idea for Gitea. labels: ["type/proposal"] body: - type: markdown attributes: value: | - 1. Please speak English, this is the language all maintainers can speak and write. - 2. Please ask questions or configuration/deploy problems on our Discord - server (https://discord.gg/gitea) or forum (https://forum.gitea.com). - 3. Please take a moment to check that your feature hasn't already been suggested. + Search [existing issues](https://github.com/go-gitea/gitea/issues?q=is%3Aissue) first. - type: textarea - id: description + id: problem attributes: - label: Feature Description - placeholder: | - I think it would be great if Gitea had... + label: What problem would this solve? validations: required: true - type: textarea - id: screenshots + id: proposal attributes: - label: Screenshots - description: If you can, provide screenshots of an implementation on another site e.g. GitHub + label: What do you propose? + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/ui.bug-report.yaml b/.github/ISSUE_TEMPLATE/ui.bug-report.yaml deleted file mode 100644 index 3ad5dbaf54..0000000000 --- a/.github/ISSUE_TEMPLATE/ui.bug-report.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: Web Interface Bug Report -description: Something doesn't look quite as it should? Report it here! -labels: ["type/bug", "topic/ui"] -body: - - type: markdown - attributes: - value: | - NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue. - - type: markdown - attributes: - value: | - 1. Please speak English, this is the language all maintainers can speak and write. - 2. Please ask questions or configuration/deploy problems on our Discord - server (https://discord.gg/gitea) or forum (https://forum.gitea.com). - 3. Please take a moment to check that your issue doesn't already exist. - 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq) - 5. Please give all relevant information below for bug reports, because - incomplete details will be handled as an invalid report. - 6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript - error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us - DEBUG level logs. (See https://docs.gitea.com/administration/logging-config#collecting-logs-for-help) - - type: textarea - id: description - attributes: - label: Description - description: | - Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below) - If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services. - - type: textarea - id: screenshots - attributes: - label: Screenshots - description: Please provide at least 1 screenshot showing the issue. - validations: - required: true - - type: input - id: gitea-ver - attributes: - label: Gitea Version - description: Gitea version (or commit reference) your instance is running - validations: - required: true - - type: dropdown - id: can-reproduce - attributes: - label: Can you reproduce the bug on the Gitea demo site? - description: | - If so, please provide a URL in the Description field - URL of Gitea demo: https://demo.gitea.com - options: - - "Yes" - - "No" - validations: - required: true - - type: input - id: os-ver - attributes: - label: Operating System - description: The operating system you are using to access Gitea - - type: input - id: browser-ver - attributes: - label: Browser Version - description: The browser and version that you are using to access Gitea - validations: - required: true diff --git a/.github/actions/go-cache/action.yml b/.github/actions/go-cache/action.yml index 04d4bac367..7096fa3952 100644 --- a/.github/actions/go-cache/action.yml +++ b/.github/actions/go-cache/action.yml @@ -1,47 +1,51 @@ name: go-caches -description: Restore and save go module, build, and golangci-lint caches +description: Restore the go module, build, and golangci-lint caches. Save only on the cache-seeder workflow. + +# Only the cache-seeder workflow saves; rename requires updating cache-seeder.yml. +# The lint job restores but does not save the gobuild cache, so only one writer +# (the gobuild job) populates it and there is no contention on the cache key. inputs: - cache-name: - description: Short identifier used in the per-caller build cache key - required: true - build-cache: - description: Whether to include ~/.cache/go-build - default: "true" - build-cache-rotate: - description: Whether to rotate the build cache key per run so Go's test result cache can accumulate across runs - default: "false" lint-cache: - description: Whether to include ~/.cache/golangci-lint + description: Restore (and save in cache-seeder) ~/.cache/golangci-lint default: "false" runs: using: composite steps: - - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - if: ${{ github.workflow == 'cache-seeder' }} + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/go/pkg/mod key: gomod-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} restore-keys: gomod-${{ runner.os }}-${{ runner.arch }} - - if: ${{ inputs.build-cache == 'true' && inputs.build-cache-rotate == 'true' }} - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - if: ${{ github.workflow != 'cache-seeder' }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - path: ~/.cache/go-build - key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum') }}-${{ github.run_id }} - restore-keys: | - gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum') }} - gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }} - gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} - gobuild-${{ runner.os }}-${{ runner.arch }} - - if: ${{ inputs.build-cache == 'true' && inputs.build-cache-rotate != 'true' }} + path: ~/go/pkg/mod + key: gomod-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} + restore-keys: gomod-${{ runner.os }}-${{ runner.arch }} + - if: ${{ github.workflow == 'cache-seeder' && inputs.lint-cache != 'true' }} uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.cache/go-build key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} restore-keys: gobuild-${{ runner.os }}-${{ runner.arch }} - - if: ${{ inputs.lint-cache == 'true' }} + - if: ${{ github.workflow != 'cache-seeder' || inputs.lint-cache == 'true' }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/go-build + key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} + restore-keys: gobuild-${{ runner.os }}-${{ runner.arch }} + - if: ${{ inputs.lint-cache == 'true' && github.workflow == 'cache-seeder' }} uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.cache/golangci-lint - key: golangci-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum', '.golangci.yml') }} - restore-keys: golangci-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }} + key: golint-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum', '.golangci.yml') }} + restore-keys: golint-${{ runner.os }}-${{ runner.arch }} + - if: ${{ inputs.lint-cache == 'true' && github.workflow != 'cache-seeder' }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/golangci-lint + key: golint-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum', '.golangci.yml') }} + restore-keys: golint-${{ runner.os }}-${{ runner.arch }} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 91d001e078..6ae22da7be 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,11 +1,9 @@ - -Please check the following: -1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for backports. -2. Use a Conventional Commits PR title, for example `fix(repo): handle empty branch names`. -3. Make sure you have read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md . -4. For documentations contribution, please go to https://gitea.com/gitea/docs -5. Describe what your pull request does and which issue you're targeting (if any). -6. It is recommended to enable "Allow edits by maintainers", so maintainers can help more easily. -7. Your input here will be included in the commit message when this PR has been merged. If you don't want some content to be included, please separate them with a line like `---`. -8. Delete all these tips before posting. - + diff --git a/.github/workflows/cache-seeder.yml b/.github/workflows/cache-seeder.yml index 733077cc80..91109b1c06 100644 --- a/.github/workflows/cache-seeder.yml +++ b/.github/workflows/cache-seeder.yml @@ -1,15 +1,9 @@ -# Populates the go module, build, and golangci-lint caches under the default -# branch's cache scope so that PR runs have a warm fallback to restore from. +# Populates main's cache scope so PR runs warm-start from it. Saves the go +# module, go build (incl. test compile), and golangci-lint caches. # -# GitHub Actions caches are scoped per ref: a PR run can only write to its own -# branch's scope, but can read from the base branch's scope as a fallback. -# PRs therefore cannot seed main's scope themselves. Running the same cache -# steps on push-to-main is the only opportunity to populate that fallback -# scope so fresh PR branches start with a useful cache on first run. - -# A PR job's exact key lives in its own PR-scope (empty on first run, filled -# by later runs of the same PR); on miss, actions/cache's restore-keys fall -# back to prefix matches against entries this seeder saves in main's scope. +# Caches are ref-scoped: PR runs read their own scope then fall back to the +# base branch. Per .github/actions/go-cache/action.yml, PRs are restore-only, +# so push-to-main is the only opportunity to populate the fallback scope. name: cache-seeder @@ -41,11 +35,25 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: seed - - run: make deps-backend + - run: make deps-backend deps-tools - run: TAGS="bindata" make backend - run: TAGS="bindata gogit" GOEXPERIMENT="" make backend + - name: warm test compile cache (bindata) + env: + TAGS: bindata + GOTEST_FLAGS: -race -list=^$$ -count=1 + run: make test-backend + - name: warm test compile cache (bindata gogit) + env: + TAGS: bindata gogit + GOEXPERIMENT: + GOTEST_FLAGS: -race -list=^$$ -count=1 + run: make test-backend + - name: warm integration compile cache + run: | + TAGS="bindata" make test-integration-compile + TAGS="bindata gogit" GOEXPERIMENT="" make test-integration-compile + TAGS="bindata gogit" GOTEST_FLAGS="-race" make test-integration-compile lint: runs-on: ubuntu-latest @@ -53,7 +61,7 @@ jobs: fail-fast: false matrix: include: - - { job: lint-backend, tags: "bindata", target: "lint-backend" } + - { tags: "bindata", target: "lint-backend" } steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 @@ -63,9 +71,11 @@ jobs: cache: false - uses: ./.github/actions/go-cache with: - cache-name: ${{ matrix.job }} lint-cache: "true" - run: make deps-backend deps-tools + - run: make generate-go + env: + TAGS: ${{ matrix.tags }} - run: make ${{ matrix.target }} env: TAGS: ${{ matrix.tags }} diff --git a/.github/workflows/giteabot-backport.yml b/.github/workflows/giteabot-backport.yml new file mode 100644 index 0000000000..9a9c244b0c --- /dev/null +++ b/.github/workflows/giteabot-backport.yml @@ -0,0 +1,26 @@ +name: giteabot backport + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +jobs: + giteabot: + if: github.repository == 'go-gitea/gitea' + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: go-gitea/giteabot@d4f19d5b4a88059d8c3ca78d660631506fc0c286 # add retry logic to giteabot + with: + github_token: ${{ secrets.GITEABOT_TOKEN }} + gitea_fork: giteabot/gitea + checks: backport diff --git a/.github/workflows/giteabot.yml b/.github/workflows/giteabot.yml index dad7a19fdb..9104398889 100644 --- a/.github/workflows/giteabot.yml +++ b/.github/workflows/giteabot.yml @@ -1,9 +1,6 @@ name: giteabot on: - push: - branches: - - main # pull_request_target gives this workflow access to GITEABOT_TOKEN on PRs from # forks, which the bot needs to write labels, statuses and comments. Safe here # because the job only runs a pinned action and never checks out PR HEAD. @@ -24,9 +21,17 @@ on: schedule: - cron: "15 3 * * *" workflow_dispatch: + inputs: + checks: + description: Comma-separated list of non-backport checks to run + required: false + default: labels,merge_queue,lock,feedback,last_call,milestones,lgtm,translation_comment,pr_actions permissions: contents: read + issues: write + pull-requests: write + statuses: write concurrency: group: ${{ format('{0}-{1}', github.workflow, (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && format('pr-{0}', github.event.pull_request.number) || 'maintenance') }} @@ -38,7 +43,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - uses: go-gitea/giteabot@8996d0b0e6c4ab066e3adcaf2c49b5d4cd15d7af # v1.0.1 + # pull_request_review runs without repository secrets on fork PRs, so fall + # back to the workflow token for the non-backport checks handled here. + - uses: go-gitea/giteabot@d4f19d5b4a88059d8c3ca78d660631506fc0c286 # add retry logic to giteabot with: - github_token: ${{ secrets.GITEABOT_TOKEN }} - gitea_fork: giteabot/gitea + github_token: ${{ secrets.GITEABOT_TOKEN || github.token }} + checks: ${{ github.event.inputs.checks || 'labels,merge_queue,lock,feedback,last_call,milestones,lgtm,translation_comment,pr_actions' }} diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index 095ee6271b..ada537a188 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -27,7 +27,6 @@ jobs: cache: false - uses: ./.github/actions/go-cache with: - cache-name: lint-backend lint-cache: "true" - run: make deps-backend deps-tools - run: TAGS="bindata" make generate-go # lint-go also lints with "bindata" tags which requires "_bindata.go" @@ -47,8 +46,6 @@ jobs: - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 24 - cache: pnpm - cache-dependency-path: pnpm-lock.yaml - run: make lint-spell @@ -77,9 +74,6 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: checks-backend - build-cache: "false" - run: make deps-backend deps-tools - run: make --always-make checks-backend # ensure the "go-licenses" make target runs @@ -113,8 +107,6 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: compliance-backend - run: make deps-backend generate-go # no frontend build here as backend should be able to build, even without any frontend files # CGO is not used when cross-compile, so these steps also test if the code is compatible with CGO disabled diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index 6e91eafe3e..bc73d6391c 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -14,10 +14,14 @@ jobs: files-changed: uses: ./.github/workflows/files-changed.yml - test-pgsql: + test-pgsql-shards: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + shard: [1, 2] services: pgsql: image: postgres:14 @@ -48,8 +52,6 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: pgsql - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' - run: make deps-backend @@ -57,6 +59,7 @@ jobs: env: TAGS: bindata - name: run migration tests + if: matrix.shard == 1 run: GITEA_TEST_DATABASE=pgsql make test-migration - name: run tests run: GITEA_TEST_DATABASE=pgsql make test-integration @@ -66,6 +69,8 @@ jobs: GOTEST_FLAGS: -race -timeout=40m TAGS: bindata gogit TEST_LDAP: 1 + TEST_SHARD: ${{ matrix.shard }} + TEST_TOTAL_SHARDS: ${{ strategy.job-total }} test-sqlite: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' @@ -79,15 +84,12 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: sqlite - run: make deps-backend - run: make backend env: TAGS: bindata gogit GOEXPERIMENT: - - name: run migration tests - run: GITEA_TEST_DATABASE=sqlite make test-migration + - run: GITEA_TEST_DATABASE=sqlite make test-migration env: TAGS: bindata gogit - name: run tests @@ -145,28 +147,27 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: unit - build-cache-rotate: "true" - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 minio devstoreaccount1.azurite.local mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - - run: make backend + - run: make generate-go env: TAGS: bindata - name: unit-tests - run: make test-backend test-check + run: make test-backend env: GOTEST_FLAGS: -race -timeout=20m TAGS: bindata GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} - name: unit-tests-gogit - run: make test-backend test-check + run: make test-backend env: GOTEST_FLAGS: -race -timeout=20m TAGS: bindata gogit GOEXPERIMENT: GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + GITEA_TEST_CI_SKIP_EXTERNAL: true + - run: make test-check test-mysql: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' @@ -205,16 +206,13 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: mysql - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: TAGS: bindata - - name: run migration tests - run: GITEA_TEST_DATABASE=mysql make test-migration + - run: GITEA_TEST_DATABASE=mysql make test-migration - name: run tests run: GITEA_TEST_DATABASE=mysql make test-integration env: @@ -246,8 +244,6 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: mssql - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts' - run: make deps-backend diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index adadc0d807..7bf73d4a0f 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -26,9 +26,6 @@ jobs: check-latest: true cache: false - uses: ./.github/actions/go-cache - with: - cache-name: e2e - build-cache: "false" - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index f807f16b3f..691e6eaed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,68 @@ This changelog goes through the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.com). +## [1.26.2](https://github.com/go-gitea/gitea/releases/tag/1.26.2) - 2026-05-20 + +* SECURITY + * fix(permissions): Fix reading permission (#37769) + * fix(actions): make artifact signature payloads unambiguous (#37707) + * fix: Unify public-only token filtering in API queries and repo access checks (#37118) + * fix: Add missed token scope checking (#37735) + * fix(oauth): bind token exchanges to the original client request (#37704) + * fix(oauth): strengthen PKCE validation and refresh token replay protection (#37706) + * fix(web): enforce token scopes on raw, media, and attachment downloads (#37698) + * fix(security): enforce wiki git writes and LFS token access at request time (#37695) + * feat(api): encrypt AWS creds (#37679) + * fix(deps): update dependency mermaid to v11.15.0 [security], add e2e test + * fix(packages): Add label for private and internal package and fix composor package source permission check (#37610) + * fix(git): Fix smart http request scope bug (#37583) + * Fix basic auth bug (#37503) + * Fix allow maintainer edit permission check (#37479) (#37484) + * Fix URL sanitization to handle schemeless credentials (#37440) (#37471) + * Fix attachment Content-Security-Policy (#37455) (#37464) + * chore(deps): bump go-git/go-git/v5 to 5.19.0 (#37608) + +* BUGFIXES + * fix(pull): handle empty pull request files view to allow reviews (#37783) + * fix(markup): make RenderString never fail (#37779) + * fix: add natural sort to sortTreeViewNodes (#37772) + * fix: package creation unique conflict (#37774) + * fix!: add DEFAULT_TITLE_SOURCE setting for pull request title default behavior (#37465) + * fix: Allow direct commits for unprotected files with push restrictions (#37657) + * fix(actions): wrong assumption that run id always >= job id (#37737) + * fix(auth): set User-Agent on avatar fetch and sync avatar on link-account register (#37564) (#37588) + * fix(actions): deadlock between PrepareRunAndInsert and UpdateTaskByState (#37692) + * fix(repo): /generate must sync the branch table for the new repo (#37693) + * build: Fix snap build (1.26) + * fix(actions): run TransferLogs on UpdateLog{Rows:[], NoMore:true} (#37631) + * fix show correct mergebase + * fix: make clone URL respect public URL detection setting (#37615) + * fix: "run as root" check (#37622) + * chore(deps): update dependency go to v1.26.3 (#37601) + * Compare dropdown fails when selecting branch with no common merge-base (#37470) + * fix: treat email addresses case-insensitively (#37600) + * fix(actions): fix blank lines after ::endgroup:: (#37597) + * fix(actions): report individual step status in workflow job API response (#37592) + * fix: Invalid UTF-8 commit messages in JSON API responses (#37542) + * fix: use consistent GetUser family functions (#37553) + * fix(api): return 409 message instead of empty JSON for wrong commit id (#37572) + * fix(actions): prevent panic when workflow contains null jobs (#37570) + * Make ServeSetHeaders default to download attachment if filename exists (#37552) (#37555) + * Fix(actions): validate workflow param to prevent 500 error (#37546) (#37554) + * Don't unblock run-level-concurrency-blocked runs in the resolver (#37461) (#37538) + * Fix(packages): use file names for generic web downloads (#37514) (#37520) + * Fix merge autodetect can't close other PRs but only the last one when multiple PRs are pushed at once (#37512) (#37516) + * Fix update branch protection order (#37508) (#37513) + * Fix mCaptcha broken after Vite migration (#37492) (#37509) + * Fix review submission from single-commit PR view (#37475) (#37485) + * Fix scheduled action panic with null event payload (#37459) (#37466) + * Make GetPossibleUserByID can handle deleted user (#37430) (#37431) + * Remove excessive quote from terraform instructions (#37424) (#37426) + * Fix color regressions, add `priority` color (#37417) (#37421) + +* MISC + * Add CurrentURL template variable back (#37444) (#37449) + ## [1.26.1](https://github.com/go-gitea/gitea/releases/tag/v1.26.1) - 2026-04-21 * BUGFIXES diff --git a/Makefile b/Makefile index 782e31ccfd..94f07a4412 100644 --- a/Makefile +++ b/Makefile @@ -445,7 +445,11 @@ test-integration: @# would flood output per passing test. testcache can't help these tests anyway — @# they mutate the work directory, so cache inputs change between runs. $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c code.gitea.io/gitea/tests/integration -o ./test-integration-$(GITEA_TEST_DATABASE).test - ./test-integration-$(GITEA_TEST_DATABASE).test + ./tools/test-integration.sh ./test-integration-$(GITEA_TEST_DATABASE).test + +.PHONY: test-integration-compile +test-integration-compile: + $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c -o /dev/null code.gitea.io/gitea/tests/integration .PHONY: test-integration\#% test-integration\#%: diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 37740fb4cb..50ec3d3954 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -1172,7 +1172,7 @@ LEVEL = Info ;; Default source for the pull request title when opening a new PR. ;; "first-commit" uses the oldest commit's summary. ;; "auto" uses commit's summary if the PR only has one commit, normalizes the branch name if multiple commits. -;DEFAULT_TITLE_SOURCE = first-commit +;DEFAULT_TITLE_SOURCE = auto ;; ;; Delay mergeable check until page view or API access, for pull requests that have not been updated in the specified days when their base branches get updated. ;; Use "-1" to always check all pull requests (old behavior). Use "0" to always delay the checks. diff --git a/go.mod b/go.mod index 26c28b4938..963e5f0882 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,7 @@ require ( github.com/go-co-op/gocron/v2 v2.21.2 github.com/go-enry/go-enry/v2 v2.9.6 github.com/go-git/go-billy/v5 v5.9.0 - github.com/go-git/go-git/v5 v5.19.0 + github.com/go-git/go-git/v5 v5.19.1 github.com/go-ldap/ldap/v3 v3.4.13 github.com/go-redsync/redsync/v4 v4.16.0 github.com/go-sql-driver/mysql v1.10.0 @@ -105,11 +105,10 @@ require ( github.com/urfave/cli-docs/v3 v3.1.0 github.com/urfave/cli/v3 v3.6.1 github.com/wneessen/go-mail v0.7.3 - github.com/xeipuuv/gojsonschema v1.2.0 github.com/yohcop/openid-go v1.0.1 github.com/yuin/goldmark v1.8.2 github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc - gitlab.com/gitlab-org/api/client-go/v2 v2.25.0 + gitlab.com/gitlab-org/api/client-go/v2 v2.26.0 go.yaml.in/yaml/v4 v4.0.0-rc.3 golang.org/x/crypto v0.51.0 golang.org/x/image v0.40.0 @@ -118,7 +117,7 @@ require ( golang.org/x/sync v0.20.0 golang.org/x/sys v0.44.0 golang.org/x/text v0.37.0 - google.golang.org/grpc v1.81.0 + google.golang.org/grpc v1.81.1 google.golang.org/protobuf v1.36.11 gopkg.in/ini.v1 v1.67.2 gopkg.in/yaml.v3 v3.0.1 @@ -272,8 +271,6 @@ require ( github.com/woodsbury/decimal128 v1.3.0 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/zeebo/blake3 v0.2.4 // indirect github.com/zeebo/xxh3 v1.1.0 // indirect diff --git a/go.sum b/go.sum index b2beb0d3af..0510378cb4 100644 --- a/go.sum +++ b/go.sum @@ -304,8 +304,8 @@ github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmm github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= -github.com/go-git/go-git/v5 v5.19.0 h1:+WkVUQZSy/F1Gb13udrMKjIM2PrzsNfDKFSfo5tkMtc= -github.com/go-git/go-git/v5 v5.19.0/go.mod h1:Pb1v0c7/g8aGQJwx9Us09W85yGoyvSwuhEGMH7zjDKQ= +github.com/go-git/go-git/v5 v5.19.1 h1:nX27AnaU43/K5bKktKwgBmR9lawoYVe1Ckg0rgzzN00= +github.com/go-git/go-git/v5 v5.19.1/go.mod h1:Pb1v0c7/g8aGQJwx9Us09W85yGoyvSwuhEGMH7zjDKQ= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= @@ -731,13 +731,6 @@ github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -760,8 +753,8 @@ github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= -gitlab.com/gitlab-org/api/client-go/v2 v2.25.0 h1:ATTBB0Iiup5SRox2IPNSkkrGy/Any7FWBL1BOpZrpCU= -gitlab.com/gitlab-org/api/client-go/v2 v2.25.0/go.mod h1:OSJITkIrT0UuA3JCucEK9UEGcC1PWBkQg5WW6W4nWuo= +gitlab.com/gitlab-org/api/client-go/v2 v2.26.0 h1:1E35d1GRLb22Yq7Jr4gWptjW1+Vg7ZDGogK/SZ6ijV8= +gitlab.com/gitlab-org/api/client-go/v2 v2.26.0/go.mod h1:wx4w52UDENs3jolsL9cYT4byPNN9Pc6UpfGtCcHEIWY= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= @@ -922,8 +915,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20260401020348-3a24fdc17823 h1:YedBIttDguBl/zy2wJauEUm+DZZg4UXseWj0g/3N+yo= google.golang.org/genproto/googleapis/rpc v0.0.0-20260401020348-3a24fdc17823/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.81.0 h1:W3G9N3KQf3BU+YuCtGKJk0CmxQNbAISICD/9AORxLIw= -google.golang.org/grpc v1.81.0/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/models/activities/action.go b/models/activities/action.go index 4ffdca842a..97388402d4 100644 --- a/models/activities/action.go +++ b/models/activities/action.go @@ -436,6 +436,12 @@ type GetFeedsOptions struct { DontCount bool // do counting in GetFeeds } +func (opts *GetFeedsOptions) ApplyPublicOnly(publicOnly bool) { + if publicOnly { + opts.IncludePrivate = false + } +} + // ActivityReadable return whether doer can read activities of user func ActivityReadable(user, doer *user_model.User) bool { return !user.KeepActivityPrivate || diff --git a/models/organization/org_list.go b/models/organization/org_list.go index f37961b5f6..136417d932 100644 --- a/models/organization/org_list.go +++ b/models/organization/org_list.go @@ -54,6 +54,12 @@ type FindOrgOptions struct { IncludeVisibility structs.VisibleType } +func (opts *FindOrgOptions) ApplyPublicOnly(publicOnly bool) { + if publicOnly { + opts.IncludeVisibility = structs.VisibleTypePublic + } +} + func queryUserOrgIDs(userID int64, includePrivate bool) *builder.Builder { cond := builder.Eq{"uid": userID} if !includePrivate { diff --git a/models/renderhelper/main_test.go b/models/renderhelper/main_test.go index 331450172a..311207e855 100644 --- a/models/renderhelper/main_test.go +++ b/models/renderhelper/main_test.go @@ -5,12 +5,19 @@ package renderhelper import ( "context" + "strings" "testing" "code.gitea.io/gitea/models/unittest" "code.gitea.io/gitea/modules/markup" ) +func testRenderString(ctx *markup.RenderContext, content string) (string, error) { + var buf strings.Builder + err := markup.Render(ctx, strings.NewReader(content), &buf) + return buf.String(), err +} + func TestMain(m *testing.M) { unittest.MainTest(m, &unittest.TestOptions{ FixtureFiles: []string{"repository.yml", "user.yml"}, diff --git a/models/renderhelper/repo_comment_test.go b/models/renderhelper/repo_comment_test.go index 1443f8b3c0..e181a5bdb5 100644 --- a/models/renderhelper/repo_comment_test.go +++ b/models/renderhelper/repo_comment_test.go @@ -8,7 +8,6 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" "github.com/stretchr/testify/assert" @@ -21,7 +20,7 @@ func TestRepoComment(t *testing.T) { t.Run("AutoLink", func(t *testing.T) { rctx := NewRenderContextRepoComment(t.Context(), repo1).WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` 65f1bf27bc3bf70f64657658635e66094edbcb4d #1 @user2 @@ -39,7 +38,7 @@ func TestRepoComment(t *testing.T) { // It is Gitea's old behavior, the relative path is resolved to the repo path // It is different from GitHub, GitHub resolves relative links to current page's path - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) [./test](./test) ![/image](/image) @@ -59,7 +58,7 @@ func TestRepoComment(t *testing.T) { WithMarkupType(markdown.MarkupName) // the ref path is only used to render commit message: a commit message is rendered at the commit page with its commit ID path - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) [./test](./test) ![/image](/image) @@ -75,7 +74,7 @@ func TestRepoComment(t *testing.T) { t.Run("NoRepo", func(t *testing.T) { rctx := NewRenderContextRepoComment(t.Context(), nil).WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, "any") + rendered, err := testRenderString(rctx, "any") assert.NoError(t, err) assert.Equal(t, "

any

\n", rendered) }) diff --git a/models/renderhelper/repo_file_test.go b/models/renderhelper/repo_file_test.go index 72d98efc66..cb2852b3e3 100644 --- a/models/renderhelper/repo_file_test.go +++ b/models/renderhelper/repo_file_test.go @@ -8,7 +8,6 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" _ "code.gitea.io/gitea/modules/markup/orgmode" @@ -22,7 +21,7 @@ func TestRepoFile(t *testing.T) { t.Run("AutoLink", func(t *testing.T) { rctx := NewRenderContextRepoFile(t.Context(), repo1).WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` 65f1bf27bc3bf70f64657658635e66094edbcb4d #1 @user2 @@ -38,7 +37,7 @@ func TestRepoFile(t *testing.T) { t.Run("AbsoluteAndRelative", func(t *testing.T) { rctx := NewRenderContextRepoFile(t.Context(), repo1, RepoFileOptions{CurrentRefSubURL: "branch/main"}). WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) [./test](./test) ![/image](/image) @@ -56,7 +55,7 @@ func TestRepoFile(t *testing.T) { t.Run("WithCurrentRefSubURL", func(t *testing.T) { rctx := NewRenderContextRepoFile(t.Context(), repo1, RepoFileOptions{CurrentRefSubURL: "/commit/1234"}). WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) ![/image](/image) `) @@ -72,7 +71,7 @@ func TestRepoFile(t *testing.T) { CurrentTreePath: "my-dir", }). WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, `