Skip to content

Forgejo/Codeberg backend with editorial workflow#7726

Open
razzeee wants to merge 7 commits intodecaporg:mainfrom
razzeee:forgejo-workflow
Open

Forgejo/Codeberg backend with editorial workflow#7726
razzeee wants to merge 7 commits intodecaporg:mainfrom
razzeee:forgejo-workflow

Conversation

@razzeee
Copy link
Copy Markdown

@razzeee razzeee commented Feb 14, 2026

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 x inside each checkbox:

A picture of a cute animal (not mandatory but encouraged)
image

@razzeee razzeee requested a review from a team as a code owner February 14, 2026 15:42
@@ -0,0 +1,65 @@
backend:
name: forgejo
app_id: a582de8c-2459-4e5f-b671-80f99a0592cc
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is copied from the gittea backend and changed in name. I'm unsure how this works/it will likely need changes.

@razzeee
Copy link
Copy Markdown
Author

razzeee commented Feb 14, 2026

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
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've emptied the changelogs, as I'm unsure when they get filled

@martinjagodic
Copy link
Copy Markdown
Member

@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.

@razzeee
Copy link
Copy Markdown
Author

razzeee commented Feb 16, 2026

@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.

Copy link
Copy Markdown
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static CMS? Shouldn't this and other places mention Decap CMS?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same in the gitea backend 🫠

commitAuthor?: {};

constructor(config: Config) {
this.apiRoot = config.apiRoot || 'https://v14.next.forgejo.org/api/v1';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds sensible, will change it


async getDeployPreview() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return {} as any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`, {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread packages/decap-cms-backend-forgejo/src/implementation.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants