0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-25 20:22:53 +01:00
gitea/routers/api/v1/repo
yp05327 70b7df0e5e
Support repo license (#24872)
Close #278
Close #24076

## Solutions:
- Use
[google/licenseclassifier](https://github.com/google/licenseclassifier/)
Test result between
[google/licensecheck](https://github.com/google/licensecheck) and
[go-license-detector](https://github.com/go-enry/go-license-detector):
https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167
Test result between
[google/licensecheck](https://github.com/google/licensecheck) and
[google/licenseclassifier](https://github.com/google/licenseclassifier/):
https://github.com/go-gitea/gitea/pull/24872#issuecomment-1576092178
- Generate License Convert Name List to avoid import license templates
with same contents
Gitea automatically get latest license data from[
spdx/license-list-data](https://github.com/spdx/license-list-data).
But unfortunately, some license templates have same contents. #20915
[click here to see the
list](https://github.com/go-gitea/gitea/pull/24872#issuecomment-1584141684)
So we will generate a list of these license templates with same contents
and create a new file to save the result when using `make
generate-license`. (Need to decide the save path)
- Save License info into a new table `repo_license`
Can easily support searching repo by license in the future.

## Screen shot
Single License:

![image](https://github.com/go-gitea/gitea/assets/18380374/41260bd7-0b4c-4038-8592-508706cffa9f)

Multiple Licenses:

![image](https://github.com/go-gitea/gitea/assets/18380374/34ce2f73-7e18-446b-9b96-ecc4fb61bd70)

Triggers:
- [x] Push commit to default branch
- [x] Create repo
- [x] Mirror repo
- [x] When Default Branch is changed, licenses should be updated

Todo:
- [x] Save Licenses info in to DB when there's a change to license file
in the commit
- [x] DB Migration
- [x] A nominal test?
- [x] Select which library to
use(https://github.com/go-gitea/gitea/pull/24872#issuecomment-1560361167)
- [x] API Support
- [x] Add repo license table
- ~Select license in settings if there are several licenses(Not
recommended)~
- License board(later, not in this PR)

![image](https://github.com/go-gitea/gitea/assets/18380374/2c3c3bf8-bcc2-4c6d-8ce0-81d1a9733878)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2024-10-01 15:25:08 -04:00
..
action.go Set owner id to zero when GetRegistrationToken for repo (#31725) 2024-07-29 18:46:45 +00:00
avatar.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
blob.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
branch.go Allow force push to protected branches (#28086) 2024-07-05 18:21:56 +00:00
collaborators.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
commits.go Fix bug in getting merged pull request by commit (#32079) 2024-09-24 01:00:09 +00:00
compare.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
file.go Add return type to GetRawFileOrLFS and GetRawFile (#31680) 2024-07-25 14:06:19 +02:00
fork.go Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
git_hook.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
git_ref.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
hook.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
hook_test.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue.go Check if the due_date is nil when editing issues (#32035) 2024-09-14 12:40:36 -04:00
issue_attachment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_comment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_comment_attachment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_dependency.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_label.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_pin.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_reaction.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_stopwatch.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_subscription.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
issue_tracked_time.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
key.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
label.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
language.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
license.go Support repo license (#24872) 2024-10-01 15:25:08 -04:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
migrate.go Support migration from AWS CodeCommit (#31981) 2024-09-11 07:49:42 +08:00
milestone.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
mirror.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
notes.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
patch.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
pull.go bump to go 1.23 (#31855) 2024-09-10 02:23:07 +00:00
pull_review.go Fix the logic of finding the latest pull review commit ID (#32139) 2024-10-01 01:58:55 +00:00
release.go Handle invalid target when creating releases using API (#31841) 2024-09-12 07:47:31 +00:00
release_attachment.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
release_tags.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
repo.go Support repo license (#24872) 2024-10-01 15:25:08 -04:00
repo_test.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
star.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
status.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
subscriber.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
tag.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
teams.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
topic.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
transfer.go Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
tree.go Refactor names (#31405) 2024-06-19 06:32:45 +08:00
wiki.go Enable more revive linter rules (#30608) 2024-04-22 11:48:42 +00:00