Skip to content

Generate SVG and go-licenses.json at build time#37225

Closed
silverwind wants to merge 2 commits intogo-gitea:mainfrom
silverwind:generated-assets
Closed

Generate SVG and go-licenses.json at build time#37225
silverwind wants to merge 2 commits intogo-gitea:mainfrom
silverwind:generated-assets

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Apr 15, 2026

  • When no SVG files are present, backend renders text placeholders. We could add a dummy icon as well instead if preferred.
  • When no go licenses are present, they are omitted from licenses.txt with a warning.

This enables to update npm and go dependencies without having to run post-upgrade steps, a quasi-prerequisite to using dependency update bots.

The Makefile still keeps a strict frontend/backend separation with no dependencies between them, but I think that separation should eventually go as it causes unnecessary complexity as seen in the actions changes.

Code changes are in 7cf7974, the other commit is the removals.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 15, 2026
@silverwind silverwind changed the title Generate SVG and license assets at build time Generate SVG and go-licenses.json at build time Apr 15, 2026
silverwind and others added 2 commits April 15, 2026 02:54
Moves SVG icons, material-icon JSONs, and the Go license index out of
git; they regenerate on demand. Backend tolerates missing SVG assets
at startup.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
These files are now produced on demand by `make svg` (SVG icons,
material-icon JSONs) and by the existing `$(GO_LICENSE_FILE)` rule
(go-licenses.json). Keeping them in git bloated review diffs on
every dependency bump.

Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
@wxiaoguang
Copy link
Copy Markdown
Contributor

No, not right

image

@wxiaoguang wxiaoguang marked this pull request as draft April 15, 2026 15:18
@wxiaoguang
Copy link
Copy Markdown
Contributor

By the way, I don't think it is maintainable to keep copying these uses: steps.

No way to share the duplicate steps?

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 15, 2026

No, not right

Expected as documented in OP. Do you want me to add a placeholder instead?

By the way, I don't think it is maintainable to keep copying these uses: steps.

Yes we can extract to a reusable workflow and run it via workflow_call or some other step-reuse (need to check docs).

@TheFox0x7
Copy link
Copy Markdown
Contributor

yaml anchors work too :)

That aside, does this not cripple the license audit a bit? Right now we can check the on a PR to see if the license is detected properly for new dependencies if they show up and to check if the PR doesn't add something that would be problematic.

Didn't the attempt to move to renovate gain traction from being able to run post commands after update as opposed to dependabot?

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 15, 2026

Yes, license diff will now go unnoticed, that is the drawback. I don't think anyone really looks at this much during review.

Post-update step could be implemented in renovate but would still need to be explained to every contributor, causing friction.

@TheFox0x7
Copy link
Copy Markdown
Contributor

I don't think anyone really looks at this much during review.

I am, that's why I'm asking.

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 15, 2026

Maybe it's better to codify some rules for acceptable licenses like we already do for JS dependencies than rely on manual review. Not sure how good the license classification is for go deps given that those carry no SPDX identifiers, but worth a try if a suitable go module for classification exists.

@wxiaoguang
Copy link
Copy Markdown
Contributor

No, not right

Expected as documented in OP. Do you want me to add a placeholder instead?

Now, make watch-frontend + run Gitea server, you just don't see any SVG icon.

How can it be right? What placeholder can be right?

@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 15, 2026

Now, make watch-frontend + run Gitea server, you just don't see any SVG icon.

watch-frontend has the dependency, so the SVG build runs, but it does run concurrently with the backend startup creating a race condition and backend never reloads files with the current mechanism. I think backend needs the ability to reload SVG files.

@TheFox0x7
Copy link
Copy Markdown
Contributor

I'm not looking at the license, I'm looking at the entire bundle - what was added, why was it added, does it match what I can dig out manually.
It's not "does this accidentally pull GPL?" which you can catch with trivy or something alike, its a "does the new addition/removal match what the project requires at to keep at minimum". It's a rare thing that it changes but I'd rather be able to look at it if I can, just to be sure the license text isn't garbage or just a reference.
I find it useful in that regard.

@silverwind
Copy link
Copy Markdown
Member Author

Yes, I agree it's useful side-info.

@silverwind
Copy link
Copy Markdown
Member Author

Decided to keep the generated files for now, so the renovate PR needs to adopt a post-update script.

@silverwind silverwind closed this Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants