Forgejo/Codeberg backend with editorial workflow#7726
Forgejo/Codeberg backend with editorial workflow#7726razzeee wants to merge 7 commits intodecaporg:mainfrom
Conversation
| @@ -0,0 +1,65 @@ | |||
| backend: | |||
| name: forgejo | |||
| app_id: a582de8c-2459-4e5f-b671-80f99a0592cc | |||
There was a problem hiding this comment.
This is copied from the gittea backend and changed in name. I'm unsure how this works/it will likely need changes.
|
You also might want to go through this commit by commit. The first one is just a copy of the gittea backend into the new folder, so changes should be obvious from the second commit. |
| @@ -0,0 +1 @@ | |||
| # Change Log | |||
There was a problem hiding this comment.
I've emptied the changelogs, as I'm unsure when they get filled
|
@razzeee, thanks for the PR. If Forgejo is a fork of Gitea, could one backend support both, or did they change the API so much that it's not possible? It would be much easier to maintain one backend than 2. |
The only thing, that's on top of my head is, that the api for merging upstream is different. I orignially started with everything in the gitea backend, but it seemed weird at the point, where the api started to be so different. And it might be hard to communicate to users (that's also a problem for codeberg) - but I guess docs might work, even if the backend name ends up weird? Then again, I don't have access to a gitea backend, so I can't confirm, the changes work fine over there. |
yanthomasdev
left a comment
There was a problem hiding this comment.
Great work @razzeee, I am not used to Forgejo but I have a few comments for you.
| this.originRepoName = originRepoParts[1]; | ||
| } | ||
|
|
||
| static DEFAULT_COMMIT_MESSAGE = 'Automatically generated by Static CMS'; |
There was a problem hiding this comment.
Static CMS? Shouldn't this and other places mention Decap CMS?
There was a problem hiding this comment.
It's the same in the gitea backend 🫠
| commitAuthor?: {}; | ||
|
|
||
| constructor(config: Config) { | ||
| this.apiRoot = config.apiRoot || 'https://v14.next.forgejo.org/api/v1'; |
There was a problem hiding this comment.
Correct me if I am wrong, but this is a development/staging API, no? Haven't used Forgejo myself before, but since it's self-hosted, should we make it obligatory to set their own API root and throw if it's not set?
There was a problem hiding this comment.
That sounds sensible, will change it
|
|
||
| async getDeployPreview() { | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| return {} as any; |
There was a problem hiding this comment.
I guess this should return null so it matches other backends. I know you got this from the Gitea backend that also returns {}, so could you also update it?
| // Authorized user | ||
| return { | ||
| name: user.full_name, | ||
| login: user.login, |
There was a problem hiding this comment.
We added a new feature that needs to pass down email, can you add it?
|
|
||
| async mergeUpstream(): Promise<void> { | ||
| try { | ||
| await this.request(`${this.repoURL}/sync_fork`, { |
There was a problem hiding this comment.
Can you confirm this is correct? I am having trouble finding the API reference but I found references to /repos/{owner}/{repo}/branches/{branch}/sync_fork or /repos/{owner}/{repo}/mirror-sync
There was a problem hiding this comment.
we tested it when I've implemented it and it was working - but haven't tried since then, as the website I did this for is not yet live
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Summary
We're currently working on a website with a CMS. But we don't want to use github, so we switched to codeberg.
This is an implementation of forgejo (a gitea fork) - based on the gitea backend. Then we've amended the endpoints to be correct for forgejo and added editorial workflow handling.
Test plan
I've ran all tests locally, that work on my machine (cypress still doesn't have fedora integration)
As far as we've tested, it seems to work fine.
You can use your codeberg accounts to test here https://diday.sxda.io/admin/ but we won't merge changes :)
Checklist
Please add a
xinside each checkbox:A picture of a cute animal (not mandatory but encouraged)
