Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Past GitHub sponsors are randomly generated #42

Closed
5 tasks done
MichalLytek opened this issue Mar 8, 2023 · 10 comments
Closed
5 tasks done

Past GitHub sponsors are randomly generated #42

MichalLytek opened this issue Mar 8, 2023 · 10 comments

Comments

@MichalLytek
Copy link

Describe the bug

I have a cron workflow which is supposed to refresh github sponsors every night.

However, I see that every night it's generating a new image and committing the changes, leading to polluting the master branch.
When I check the svg file diff, it's just about swapping the places of the past sponsors.

image

I think the sponsorkit should stable sort the fetched sponsors, so that the images are generated in the same way, so that the cron workflow will skip commit as no changes detected by git.

In local mode, cache.json plays the role of the moderator, detecting no changes in fetched data.
However, in a cron workflow it might be harder to achieve.
If I delete it, it's again randomizing order of past sponsors.

Reproduction

https://github.com/MichalLytek/type-graphql/blob/master/.github/workflows/sponsor.yml

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 5700X 8-Core Processor
    Memory: 12.78 GB / 15.58 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.19.0/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@antfu
Copy link
Member

antfu commented Mar 8, 2023

We could do a sorting, PR welcome :)

@carlocorradini
Copy link
Contributor

Can we add a sort (or sortBy) to BadgePreset with default values. Examples:

sort: "ASC"

// or
sort: { name: "ASC" }

@antfu
Copy link
Member

antfu commented Mar 8, 2023

We could always sort (by priority of sponsor amount -> sponsor date -> name alphabet). And maybe accepting a custom sort function if one wants to have full control (I imagine most of the cases there is no need to use it)

@carlocorradini
Copy link
Contributor

Awesome. Agree on sponsor amount > sponsor date > name alphabet.
The sort function is the copy of the one from array implementation :)

@carlocorradini
Copy link
Contributor

@antfu Always sorting includes all the providers?

@antfu
Copy link
Member

antfu commented Mar 9, 2023

We could do that in the core instead of providers

@carlocorradini
Copy link
Contributor

@antfu
Copy link
Member

antfu commented Mar 9, 2023

Yeah I think so

@carlocorradini
Copy link
Contributor

@MichalLytek See #43

@carlocorradini
Copy link
Contributor

carlocorradini commented Mar 9, 2023

Can we close this? @antfu

PS: My bad, I forgot to add Fix

@antfu antfu closed this as completed Mar 9, 2023
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

No branches or pull requests

3 participants