Commit graph

541 commits

Author SHA1 Message Date
0c24c1e6e7
add repo action secret creation 2024-09-12 15:13:17 -04:00
qwerty287
136185be68 Exclude headers from error 2024-07-20 09:41:06 +00:00
Martijn van der Kleijn
e2b63c6b49 Add release badge to readme
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-16 01:49:55 +02:00
Martijn van der Kleijn
b7c7d5ab5f Use different avatar URL when testing in CI
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-16 00:11:17 +02:00
Martijn van der Kleijn
8cd818c535 Update CI workflows to run on PR for integration
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-16 00:10:32 +02:00
Martijn van der Kleijn
c686623cee ci: update testing for Forgejo 7.0.4 release (#12)
- bump Forgejo version to test against to 7.0.4
- ci: Increase the number of milestones to be checked in the test from 2 to 3
- ci: improve test stability by increasing sleep by 100ms
- ci: update avatar url in user test and test more user emails

Reviewed-on: https://codeberg.org/mvdkleijn/forgejo-sdk/pulls/12
Co-authored-by: Martijn van der Kleijn <martijn.niji@gmail.com>
Co-committed-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-15 21:37:06 +00:00
Martijn van der Kleijn
bbaa2f11ad Bump go version in readme
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-15 22:47:34 +02:00
Martijn van der Kleijn
17f01278c2 Ensure we don't trigger build or integration when adjusting docs only
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-15 22:39:47 +02:00
qwerty287
a61bd5aa85 Improve testing workflows (#7)
- make files non hidden
- remove forgejo actions files
- simplfy commands
- remove useless `setup` step (checkout is done by CI, and clean up is not necessary before the build)

Reviewed-on: https://codeberg.org/mvdkleijn/forgejo-sdk/pulls/7
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2024-06-15 20:14:45 +00:00
Martijn van der Kleijn
0f7828d232 Reduce complexity for newHTTPSign()
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-14 23:26:07 +02:00
Martijn van der Kleijn
fffff7bd62 Fix wrong packagename in makefile
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-14 22:48:24 +02:00
Martijn van der Kleijn
1a95b51371 Mark gosec false positives
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-14 22:35:52 +02:00
Martijn van der Kleijn
9f2db4129e Adding ci.codeberg.org pipeline status to README
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-11 18:12:28 +02:00
Martijn van der Kleijn
168c988b82 Remove custom gitea-vet from testing workflow
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-07 23:51:51 +02:00
Martijn van der Kleijn
1caf6712f4 Allow Forgejo to startup before attempting verification
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-07 23:34:20 +02:00
Martijn van der Kleijn
b2a29682b9 Add woodpecker ci pipeline files
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-06-07 23:18:35 +02:00
Martijn van der Kleijn
d2f7239d02 Bump dependencies
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 17:49:13 +02:00
Martijn van der Kleijn
ae325d4bec Correct misspelling Forgjo
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 17:43:42 +02:00
Martijn van der Kleijn
c7d07f49b6 Merge pull request 'Cherry pick latest commits from Gitea SDK' (#4) from chore-cherry-pick-gitea-sdk-updates into main
Reviewed-on: https://codeberg.org/mvdkleijn/forgejo-sdk/pulls/4
2024-05-03 15:41:06 +00:00
Bo-Yi Wu
29513fc519 feat: implement organization action secret creation (#661)
- Add `bytes` and `encoding/json` imports to `org_action.go`
- Implement `CreateSecretOption` struct with validation in `org_action.go`
- Add `CreateOrgActionSecret` function to create or update organization secrets in `org_action.go`
- Create new test file `org_action_test.go` with tests for creating and updating organization secrets
- Add `Data` field to `Secret` struct in `secret.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/661
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-03 17:39:02 +02:00
tobiasbp
e21c012dcb Get fields loginName & SourceID for users (#654)
This _PR_ adds the following fields to the _User_ struct:

-  _LoginName_: Currently returned by the Gitea API.
- _SourceID_: [Scheduled to be returned by the Gitea API as of version 1.22.0](https://github.com/go-gitea/gitea/pull/29718).

The fields are used for users with non-local Authentication Sources (LDAP, oAuth etc.).

Co-authored-by: tobias.petersen <tobias.petersen@unity3d.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/654
Reviewed-by: appleboy <appleboy.tw@gmail.com>
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: tobiasbp <tobiasbp@noreply.gitea.com>
Co-committed-by: tobiasbp <tobiasbp@noreply.gitea.com>
2024-05-03 17:37:08 +02:00
Bo-Yi Wu
f12d597965 feat(repo): support list of repo secrets (#660)
- Update comment to correctly describe `ListOrgActionSecretOption` as listing organization secrets instead of members
- Add new file `repo_action.go` with functionality to list a repository's secrets including the structure and API call

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/660
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-03 17:36:32 +02:00
appleboy
e9585a460d feat: implement commit comparison feature in Gitea client (#659)
See the API: https://github.com/go-gitea/gitea/pull/30349

- Add a new file `repo_compare.go` with package `gitea` and `Compare` struct
- Implement `CompareCommits` method in `Client` struct in `repo_compare.go`
- Add `version1_22_0` constant in `version.go`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/659
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2024-05-03 17:34:26 +02:00
appleboy
54cf14f67a chore: update Go module dependencies to latest versions (#658)
- Update the version of `golang.org/x/crypto` from `v0.17.0` to `v0.22.0` in `go.mod`
- Update the version of `golang.org/x/sys` from `v0.15.0` to `v0.19.0` in `go.mod`

Signed-off-by: appleboy <appleboy.tw@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/658
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2024-05-03 17:30:19 +02:00
rjhaverkamp
62be687147 Fix typo in visibilty error (#653)
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/653
Reviewed-by: John Olheiser <jolheiser@noreply.gitea.com>
Co-authored-by: rjhaverkamp <rjhaverkamp@noreply.gitea.com>
Co-committed-by: rjhaverkamp <rjhaverkamp@noreply.gitea.com>
2024-05-03 17:28:03 +02:00
6543
8942536a0b Make only referenc of ErrUnknownVersion an error (#648)
just a refactor nit

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/648
Reviewed-by: John Olheiser <jolheiser@noreply.gitea.com>
2024-05-03 17:27:14 +02:00
Martijn van der Kleijn
f4c493667c Make final corrections before fork is finalized (#3)
Reviewed-on: https://codeberg.org/mvdkleijn/forgejo-sdk/pulls/3
Co-authored-by: Martijn van der Kleijn <martijn.niji@gmail.com>
Co-committed-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 14:54:54 +00:00
Martijn van der Kleijn
9bcec8a3b0 Correct module name
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 16:35:47 +02:00
Martijn van der Kleijn
b52a4e20e1 Correct README.md listed go version
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 16:35:25 +02:00
Martijn van der Kleijn
2e9e2fa7a3 feat: fork Gitea SDK (#1)
Reviewed-on: https://codeberg.org/mvdkleijn/forgejo-sdk/pulls/1
Co-authored-by: Martijn van der Kleijn <martijn.niji@gmail.com>
Co-committed-by: Martijn van der Kleijn <martijn.niji@gmail.com>
Signed-off-by: Martijn van der Kleijn <martijn.niji@gmail.com>
2024-05-03 16:35:08 +02:00
diogo464
5d0143e4e7 fix: updated repository field in Package struct (#647)
The definition for `Package` in the most recent api switch the
repository field from a string to a `Repository`.
Without this fix api calls like ListPackages will fail to deserialize
the response.

Co-authored-by: diogo464 <diogo464@protonmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/647
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: John Olheiser <jolheiser@noreply.gitea.com>
Co-authored-by: diogo464 <diogo464@noreply.gitea.com>
Co-committed-by: diogo464 <diogo464@noreply.gitea.com>
2024-01-29 05:38:16 +00:00
Simon Ser
53f735b911 Add support for user hooks (#644)
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/644
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Reviewed-by: John Olheiser <jolheiser@noreply.gitea.com>
Co-authored-by: Simon Ser <contact@emersion.fr>
Co-committed-by: Simon Ser <contact@emersion.fr>
2024-01-25 16:04:00 +00:00
Christian Groschupp
98b424a8af feat(release): add GetLatestRelease method (#639)
This PR adds the GetLatestRelease method to support the /repos/{owner}/{repo}/releases/latest endpoint.
ref: https://docs.gitea.com/api/1.20/#tag/repository/operation/repoGetLatestRelease

Resolves gitea/go-sdk#630

Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/639
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Christian Groschupp <christian@groschupp.org>
Co-committed-by: Christian Groschupp <christian@groschupp.org>
2024-01-06 05:14:12 +00:00
Bo-Yi Wu
2abfdd7ba6 chore: update dependencies to latest versions (#646)
- Update the version of `github.com/hashicorp/go-version` from `v1.5.0` to `v1.6.0`
- Update the version of `golang.org/x/crypto` from `v0.0.0-20220525230936-793ad666bf5e` to `v0.17.0`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/646
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2023-12-31 04:06:05 +00:00
Andreas Wachter
8f4d3d8916 increased description limits to 2048 (#645)
I noticed that the description limits on gitea were changed to 2048 characters last year, but it was still 255 in the SDK.

Here the corresponding commit on gitea:
8351172b6e

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/645
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: Andreas Wachter <andreas.wachter@buddyspencer.monster>
Co-committed-by: Andreas Wachter <andreas.wachter@buddyspencer.monster>
2023-12-30 04:48:39 +00:00
ysicing
bde56fb9bb feat(repo): update repo field (#642)
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/642
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com>
Co-authored-by: ysicing <i@ysicing.me>
Co-committed-by: ysicing <i@ysicing.me>
2023-12-24 20:16:02 +00:00
ysicing
228d6931f4 feat(repo-mirrors): add repo sync mirrors (#640)
add sync mirrors

Signed-off-by: ysicing <i@ysicing.me>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/640
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ysicing <i@ysicing.me>
Co-committed-by: ysicing <i@ysicing.me>
2023-12-24 20:15:31 +00:00
appleboy
c8745e1599 feat: add new constants for repository actions (#643)
- Add a new constant `RepoUnitActions` to represent the actions of a repository

Signed-off-by: appleboy <appleboy.tw@gmail.com>

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/643
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2023-12-17 04:36:39 +00:00
Lauris BH
0e0a4691b6 Add Link header parsing in response (#638)
Helps if need to get all data that can not be requested in single page

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/638
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: appleboy <appleboy.tw@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-committed-by: Lauris BH <lauris@nix.lv>
2023-12-04 14:50:48 +00:00
crapStone
e23e8aa300 add option to set user-agent to gitea client (#637)
This PR adds the ability to set a custom user-agent to the gitea client

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/637
Reviewed-by: 6543 <6543@obermui.de>
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Co-authored-by: crapStone <crapstone01@gmail.com>
Co-committed-by: crapStone <crapstone01@gmail.com>
2023-11-15 01:43:37 +00:00
venc0r
d5e174e5b5 feat(hook): add support for authorization_header in webhooks (#633)
fixes #632

Co-authored-by: Jörg Markert <venc0r@live.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/633
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Co-authored-by: venc0r <venc0r@noreply.gitea.com>
Co-committed-by: venc0r <venc0r@noreply.gitea.com>
2023-09-26 00:01:48 +00:00
appleboy
0141b499c9 docs: update badges in README.md file (#628)
- Remove the badge for build status from the README.md file
- Add a badge for the MIT license to the README.md file
- Add a badge for the release to the README.md file
- Add a badge for the chat to the README.md file
- Add a badge for microbadger to the README.md file
- Add a badge for the Go Report Card to the README.md file
- Add a badge for GoDoc to the README.md file

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/628
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
2023-09-06 02:23:01 +00:00
Bo-Yi Wu
091528835f feat: Add API routes to list org secrets (#629)
- Add a new file `gitea/org_action.go`
- Add a new file `gitea/secret.go`

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

block by https://github.com/go-gitea/gitea/pull/26485

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/629
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2023-08-15 15:15:48 +00:00
infinoid
ae1583a7be Add missing fields to BranchProtection and related structs (#626)
the `gitea.BranchProtection` struct is missing some fields which are present in the actual gitea API (and swagger).

* BranchProtection.RuleName was added in gitea v1.19.0, via [PR #20825](https://github.com/go-gitea/gitea/pull/20825)
* BranchProtection.UnprotectedFilePatterns was added in gitea v1.16.0, via [PR #16395](https://github.com/go-gitea/gitea/pull/16395)

This PR adds those fields to the BranchProtection struct, and the related Create and Edit option structs, to match the structs [defined](https://github.com/go-gitea/gitea/blob/main/modules/structs/repo_branch.go#L27) on the gitea server side.

Co-authored-by: Mark Glines <mark@glines.org>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/626
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Reviewed-by: delvh <dev.lh@web.de>
Co-authored-by: infinoid <infinoid@noreply.gitea.com>
Co-committed-by: infinoid <infinoid@noreply.gitea.com>
2023-08-01 16:26:41 +00:00
John Olheiser
93cfc320cf Update PR template (#627)
Noted by @ infinoid (thanks!)

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/627
2023-08-01 14:50:16 +00:00
b398f0fcac
0fe2ace132 Access the details of packages (#620)
This pull request provides access to the packages API by allowing packages to be listed, retrieved individually and for the files within a package to be listed.

Resolves gitea/go-sdk#619.

Co-authored-by: root <root@prxdevgw.westeros>
Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/620
Co-authored-by: b398f0fcac <b398f0fcac@noreply.gitea.com>
Co-committed-by: b398f0fcac <b398f0fcac@noreply.gitea.com>
2023-07-15 02:59:55 +00:00
Alessandro De Blasis
f4be505bf6 feat(oauth2): confidential_client handling (#625)
This PR adds support for the `confidential_client` in `oauth2` to reflect the swagger APIs.

It has been surfaced here: https://github.com/Lerentis/terraform-provider-gitea/pull/46

Simple tests have also been added.

Please note that in this PR I am considering the current behaviour:

> if confidential_client is not set, it's assumed that it's false

However, from the swagger, it seems that the implicit default is `true` instead.

Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/625
Co-authored-by: Alessandro De Blasis <alex@deblasis.net>
Co-committed-by: Alessandro De Blasis <alex@deblasis.net>
2023-07-15 02:55:06 +00:00
JohnWalkerx
315cf7aac8 Add missing MergePullRequestOption parameters for head_commit_id and merge_when_checks_succeed (#624)
This PR adds the missing parameters for MergePullRequestOption `head_commit_id` and `merge_when_checks_succed` like in the current Gitea API.
Resolves #623

Signed-off-by: Johannes Lauffer <johnwalkerx@mailbox.org>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/624
Co-authored-by: JohnWalkerx <johnwalkerx@mailbox.org>
Co-committed-by: JohnWalkerx <johnwalkerx@mailbox.org>
2023-07-15 02:53:03 +00:00
Zettat123
970776d1c1 Switch to Gitea Actions (#618)
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/618
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-committed-by: Zettat123 <zettat123@gmail.com>
2023-05-09 11:50:20 +08:00
Norwin
24a404e561 Add GetIssueTemplates() (#603)
This API was added in 1.16, [template forms](https://github.com/go-gitea/gitea/pull/20987) will be in 1.18.
I don't think we need to add version checks, as the respective `.Form` field will just be empty on unsupported versions, but correct me if I'm wrong here.

fixes #547

- i took the freedom to change the struct property names from the API names for clarity
- I didn't add  tests because it would effectively just test gitea's API to be functional  (as long as there is only this GET method)

Co-authored-by: John Olheiser <john+gitea@jolheiser.com>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/603
Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.io>
Reviewed-by: John Olheiser <john+gitea@jolheiser.com>
Co-authored-by: Norwin <git@nroo.de>
Co-committed-by: Norwin <git@nroo.de>
2023-04-20 00:19:26 +08:00