Create contributions for pull request reviews #64
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/49-code_review_kredits"
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?
Closes #49
This script aggregates all reviews for pull requests to any Kosmos projects (on Github and Gitea) that were merged in a given timeframe. It creates a single Kredits contribution per user for all those reviews.
Running the script without any arguments prompts a list and description of all arguments.
At the moment it does't create the actual contributions yet, because I don't have a working dev setup for the contracts yet. You can use the
--dry
option for a dry run that lists the contribution data.The list of repositories is configured in
repos.json
.EDIT: Only thing needed for testing the script is a Gitea and Github API token. Set them as environment variables
GITEA_TOKEN
andGITHUB_TOKEN
or add them to the.env
file (see.env.example
).@galfert I tried to give this a dry run, I'm probably doing something wrong - this is my first time touching this repo. Here's what I tried:
@silverbucket I think you didn't set the
GITHUB_TOKEN
andGITEA_TOKEN
environment variables. See last part of the PR description.Weird: I already had a
GITHUB_TOKEN
in my global environment from a different program, but not aGITEA_TOKEN
. I got one error from a Gitea repo, but it looks like the rest all worked, including Gitea:... the error I'm seeing is a bug in Gitea. It produces a 500 response for me, when looking at it without being authenticated.
Edit: I added a dotenv config with a Gitea API token, but still seeing the same error.
Edit 2: I had a look, and even with the token I get a 500 in the script (vs. a good response in the browser while authed). The review for which I get the 500 is actually still "pending" and the PR is closed. So it's some kind of edge case bug. The rest looks fine to me, but I think we don't need API tokens at all for public Gitea repos.
Nice! 👍
As stated in my last comment, I don't think we need API tokens for Gitea. I can access the public repos' endpoints without authentication.
I thought a bit about displaying in Kredits Web, and I think the format is OK for that already. We can implement conditional loading of details in that view if necessary.
However, we do still need to adjust the description of the contributions!
I think the Gitea API token is needed. There is a pretty low limit for unauthenticated requests.
I also got the same error when not setting the API token, but with token I don't get any error.
Can we provide a useful error message in that case?
Later, sure. This PR is just about pure functionality, not UX. It is not the actual hubot integration yet.
OK, got it. Not sure why it didn't work with my token then.
I've added an error message when any of the API tokens are missing.
Also the description contains the timeframe now.
I will add the code for wallet setup and actual contribution creation in a separate PR when this has been merged.