Git Product home page Git Product logo

Comments (4)

yardenshoham avatar yardenshoham commented on August 16, 2024

I think it's because @denykson removed the self-review request. He should try to request a self-review

from gitea-backporter.

denyskon avatar denyskon commented on August 16, 2024

@yardenshoham Re-requesting review didn't work, so I tried removing the review request

from gitea-backporter.

yardenshoham avatar yardenshoham commented on August 16, 2024

Hmmm that's weird, you can review the approval logic here

export const getPrReviewers = async (
pr: { number: number; requested_reviewers: { login: string }[] },
): Promise<{ approvers: Set<string>; blockers: Set<string> }> => {
// load all reviews
const reviews: {
state:
| "APPROVED"
| "CHANGES_REQUESTED"
| "COMMENTED"
| "DISMISSED"
| "PENDING";
user: { login: string };
}[] = [];
let page = 1;
while (true) {
const response = await fetch(
`${GITHUB_API}/repos/go-gitea/gitea/pulls/${pr.number}/reviews?per_page=100&page=${page}`,
{ headers: HEADERS },
);
if (!response.ok) throw new Error(await response.text());
const results: [] = await response.json();
if (results.length === 0) break;
reviews.push(...results);
page++;
}
// count approvers and blockers by replaying all reviews (they are already sorted)
const approvers = new Set<string>();
const blockers = new Set<string>();
for (const review of reviews) {
switch (review.state) {
case "APPROVED":
approvers.add(review.user.login);
blockers.delete(review.user.login);
break;
case "DISMISSED":
approvers.delete(review.user.login);
blockers.delete(review.user.login);
break;
case "CHANGES_REQUESTED":
approvers.delete(review.user.login);
blockers.add(review.user.login);
break;
default:
break;
}
}
// any requested reviewers are not approvers
for (const requestedReviewer of pr.requested_reviewers) {
approvers.delete(requestedReviewer.login);
}
return { approvers, blockers };
};

from gitea-backporter.

yardenshoham avatar yardenshoham commented on August 16, 2024

Actually this is working as designed, we don't dismiss blockers on review request. Only on review dismiss. The problem is that we can't detect a self-review request, only that a review from the user is requested. So the algorithm has a flaw, you can't dismiss a blocker if you are a non-merger maintainer.

You could approve then request self-review, that'll do it.

from gitea-backporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.