Codeberg/Community
54
325
Fork
You've already forked Community
12

Show Codeberg: Readme badge with total stars count (Codeberg + Github) #391

Open
opened 2021年01月26日 03:37:55 +01:00 by vladimyr · 5 comments

Disclaimer This is not an issue. I apologize for polluting issue tracker but I'm not sure where does Show Codeberg stuff belong. 🤔


As an avid Github stargazer, I was contemplating about Codeberg stars and it occurred to me that projects mirrored between Codeberg and Github suffer from stars fragmentation.

Take teddit for example. As of writing this, it has:

  1. 56 stars on Codeberg (https://codeberg.org/teddit/teddit)
  2. 44 stars on Github (https://github.com/teddit-net/teddit)

Codeberg users might not be aware of Github stars and vice versa. Basically, there is no way for them to show cumulative star count in their Readme which surely doesn't help from a marketing perspective.

As someone who did some https://badgen.net tweaks, I figured out I could probably solve it by creating a small Runkit endpoint utilizing Gitea & Github API.

Few keystrokes later, there you have it 🎉
https://runkit.com/vladimyr/total-stars

It can be used in the following fashion:

![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit)

which yields this nice total stars badge:

I hope that someone might find it useful 🏄

If you have any questions or improvement suggestions let me know, I'm all ears.

**Disclaimer** This is not an issue. I apologize for _polluting_ issue tracker but I'm not sure where does _Show Codeberg_ stuff belong. :thinking: --- As an avid Github stargazer, I was contemplating about Codeberg stars and it occurred to me that projects mirrored between Codeberg and Github suffer from stars fragmentation. Take teddit for example. As of writing this, it has: 1. 56 stars on Codeberg (https://codeberg.org/teddit/teddit) 2. 44 stars on Github (https://github.com/teddit-net/teddit) Codeberg users might not be aware of Github stars and vice versa. Basically, there is no way for them to show cumulative star count in their Readme which surely doesn't help from a marketing perspective. As someone who did some https://badgen.net tweaks, I figured out I could probably solve it by creating a small [Runkit](https://runkit.com) endpoint utilizing Gitea & Github API. Few keystrokes later, there you have it :tada: https://runkit.com/vladimyr/total-stars It can be used in the following fashion: ```md ![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit) ``` which yields this nice total stars badge: ![](https://badgen.net/runkit/vladimyr/total-stars/cb;owner=teddit;repo=teddit/gh;owner=teddit-net;repo=teddit) I hope that someone might find it useful :surfer: If you have any questions or improvement suggestions let me know, I'm all ears.
Owner
Copy link

Wow, that's awesome. I'm not using badges for my own repos, but I like them in most public ones.
I think we should mention this in the docs.

Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though.

Wow, that's awesome. I'm not using badges for my own repos, but I like them in most public ones. I think we should mention this in the docs. Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though.

Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though.

This endpoint, like all badgen.net powered ones, gives you the ability to specify a single icon. It can be done using several forms of icon query param:

  1. ?icon=<icon> for icons listed on https://badgen.net
  2. ?icon=https://simpleicons.now.sh/<icon>/fff for icons coming from https://simpleicons.org collection

There is an open PR on simpleicons end for adding Codeberg's logo: https://github.com/simple-icons/simple-icons/pull/4757
Once it gets merged you could do something like this:

![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff)

However, that will still give you only one icon. It would look like this, obviously with Codeberg's logo:

Someone could join together Github's and Codeberg's icons, host them somewhere and use that instead of simpleicons proxy although I don't think that the end result would look attractive. 🤔

> Is it possible to have a variant with icons? I think it might be an idea to have both icons in the label so the meaning of "total" is more clear. Don't have a clear imagination if it, though. This endpoint, like all badgen.net powered ones, gives you the ability to specify a single icon. It can be done using several forms of `icon` query param: 1. `?icon=<icon>` for icons listed on https://badgen.net 2. `?icon=https://simpleicons.now.sh/<icon>/fff` for icons coming from https://simpleicons.org collection There is an open PR on simpleicons end for adding Codeberg's logo: https://github.com/simple-icons/simple-icons/pull/4757 Once it gets merged you could do something like this: ```md ![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff) ``` However, that will still give you only one icon. It would look like this, obviously with Codeberg's logo: ![](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/github;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/github/fff) Someone could join together Github's and Codeberg's icons, host them somewhere and use that instead of simpleicons proxy although I don't think that the end result would look attractive. :thinking:
Owner
Copy link

@vladimyr Would it be possible to modify this thingy to work with arbitrary Forgejo repositories? Ideally by allowing to copy-paste the URLs to the repos there?

@vladimyr Would it be possible to modify this thingy to work with arbitrary Forgejo repositories? Ideally by allowing to copy-paste the URLs to the repos there?

use this:

https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/codeberg;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff

the result will shown as expected:
If you see this, you can't view the image as expected, try using https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/codeberg;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff into your browser address bar.

use this: ```plaintext https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/codeberg;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff ``` the result will shown as expected: ![If you see this, you can't view the image as expected, try using https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/codeberg;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff into your browser address bar.](https://badgen.net/runkit/vladimyr/total-stars/codeberg;owner=teddit;repo=teddit/codeberg;owner=teddit-net;repo=teddit?icon=https://simpleicons.now.sh/codeberg/fff)

@therealneca7 Your comment above is not helpful, because it does NOT allow to choose any other Forgejo instance, and it seems to do exactly the same thing as shared in the conversation above.

You share a pattern of repeatedly posting comments that are perceived as off-topic by community members and mostly just repeat things that were already shared. Because we are not sure about your motivation, we conclude that your behaviour might be intended as trolling and will lock access to this organization. You can request an unblock after showing successful contributions in other projects on Codeberg.

@therealneca7 Your comment above is not helpful, because it does NOT allow to choose any other Forgejo instance, and it seems to do exactly the same thing as shared in the conversation above. You share a pattern of repeatedly posting comments that are perceived as off-topic by community members and mostly just repeat things that were already shared. Because we are not sure about your motivation, we conclude that your behaviour might be intended as trolling and will lock access to this organization. You can request an unblock after showing successful contributions in other projects on Codeberg.
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Labels
Clear labels
accessibility

Reduces accessibility and is thus a "bug" for certain user groups on Codeberg.
bug

Something is not working the way it should. Does not concern outages.
bug
infrastructure

Errors evidently caused by infrastructure malfunctions or outages
Codeberg

This issue involves Codeberg's downstream modifications and settings and/or Codeberg's structures.
contributions welcome

Please join the discussion and consider contributing a PR!
docs

No bug, but an improvement to the docs or UI description will help
duplicate

This issue or pull request already exists
enhancement

New feature
infrastructure

Involves changes to the server setups, use `bug/infrastructure` for infrastructure-related user errors.
legal

An issue directly involving legal compliance
licence / ToS

involving questions about the ToS, especially licencing compliance
please chill
we are volunteers

Please consider editing your posts and remember that there is a human on the other side. We get that you are frustrated, but it's harder for us to help you this way.
public relations

Things related to Codeberg's external communication
question

More information is needed
question
user support

This issue contains a clearly stated problem. However, it is not clear whether we have to fix anything on Codeberg's end, but we're helping them fix it and/or find the cause.
s/Forgejo

Related to Forgejo. Please also check Forgejo's issue tracker.
s/Forgejo/migration

Migration related issues in Forgejo
s/Pages

Issues related to the Codeberg Pages feature
s/Weblate

Issue is related to the Weblate instance at https://translate.codeberg.org
s/Woodpecker

Woodpecker CI related issue
security

involves improvements to the sites security
service

Add a new service to the Codeberg ecosystem (instead of implementing into Gitea)
upstream

An open issue or pull request to an upstream repository to fix this issue (partially or completely) exists (i.e. Gitea, Forgejo, etc.)
wontfix

Codeberg's current set of contributors are not planning to spend time on delegating this issue.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/Community#391
Reference in a new issue
Codeberg/Community
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?