forgejo/services
Gusted 389b32f51a feat: make upload URL compatible with GitHub API (#9285)
Adds new a function, `AcceptsGithubResponse`, to the API router context struct to check if the requests accepts a Github response. Although Forgejo API will never be compatible with the Github API, historically Forgejo's API has been designed to follow that of Github closely and we know that a lot of tooling that uses the Github API can be used against the Forgejo API with little to no problem.

As a meet in the middle solution, this function can be used to respond with a more appropriate response that follows the Github API. This allows Forgejo to avoid breaking compatibility with existing users of the API and allows the API to be oh so slightly more compatible with that of Github for API clients that expect a Github response.

Because the `upload_url` field was added purely to match the Github API (forgejo/forgejo#580), it is fair to actually make it compatible with how the Github API intended it to be and that is by adding `{?name,label}` which is used by Github's Oktokit.

Only add `{?name,label}` when Forgejo knows the request accepts a Github response. This avoids breaking the API compatibility with non-Github API  clients.

Resolves Codeberg/Community#2132

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9285
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-09-15 15:53:35 +02:00
..
actions feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
agit fix: correctly mark reviews as stale for AGit PRs (#8450) 2025-07-09 07:38:00 +02:00
asymkey feat: consider WebAuthn & SSH for instance signing (#7693) 2025-04-29 10:34:07 +00:00
attachment fix: allow instance API URLs in release assets (#7644) 2025-06-09 10:01:59 +02:00
auth fix: consistently enforce 2FA on OpenID 2.0 (#9073) 2025-08-30 13:14:54 +02:00
automerge fix: check PR reference on base repository (#8431) 2025-07-06 14:23:47 +02:00
context feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
contexttest Replace the 'relative-time' element scripting with custom, translatable rewrite (#6154) 2025-05-03 14:11:01 +00:00
convert feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
cron fix: LFS GC is never running because of a bug in the parsing of the INI file (#9202) 2025-09-09 22:32:49 +02:00
doctor chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
externalaccount chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
f3 Update module code.forgejo.org/f3/gof3/v3 to v3.11.0 (forgejo) (#8056) 2025-06-03 14:24:57 +02:00
federation Sent user activities to distant federated server (#8792) 2025-08-06 16:16:13 +02:00
feed fix: very long commit messages cause pushed commits to fail to display on the action feed on MySQL (#9098) 2025-08-30 22:23:43 +02:00
forgejo
forms fix: email comments are removed from email addresses (#9074) 2025-08-30 13:15:30 +02:00
gitdiff feat(build): improve lint-locale-usage further (#8736) 2025-08-27 23:47:34 +02:00
indexer
issue feat: search in the docs directory for issue and pull request templates (#8863) 2025-08-26 22:08:10 +02:00
lfs chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
mailer feat(build): improve lint-locale-usage further (#8736) 2025-08-27 23:47:34 +02:00
markup chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
migrations Fix migration failing when importing either issues or PRs but not the other (#8892) 2025-09-01 14:05:10 +02:00
mirror feat: add configuration to only push mirror selected branches (#7823) 2025-07-12 00:39:35 +02:00
moderation feat: add configurable timeout for automatically removing resolved reports (#7940) 2025-07-28 14:52:13 +02:00
notify better comments and variable names for ActionRunNowDone (#7697) 2025-04-28 06:37:08 +00:00
org
packages fix: package cleanup rules are not applied when there are more than 200 packages (depends on MAX_RESPONSE_ITEMS) (#9219) 2025-09-09 17:39:35 +02:00
pull fix: prevent pull requests from being merged multiple times 2025-08-11 12:55:25 +02:00
redirect chore: add repo redirect unit test 2025-08-30 09:37:38 +02:00
release chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
remote chore: tune down remote user promotion debug message shown as error (#7687) 2025-04-27 20:50:48 +00:00
repository feat: Add converting mirror repos to normal to the API (#8932) 2025-09-14 14:25:05 +02:00
secrets feat: migrate action secrets to keying to store them more securely (#8692) 2025-07-29 01:03:36 +02:00
shared/automerge fix: do not ignore automerge while a PR is checking for conflicts (#8189) 2025-06-17 10:58:07 +02:00
task chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
uinotification
user fix: delete old auth token upon replacing primary email (#9076) 2025-08-30 13:16:37 +02:00
webhook feat: make upload URL compatible with GitHub API (#9285) 2025-09-15 15:53:35 +02:00
wiki chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00