Giter VIP home page Giter VIP logo

label-approved's Introduction

Label approved

adds one of 3 labels to a approved commit

"12.approvals: 1"
"12.approvals: 2"
"12.approvals: 3+

https://github.com/NixOS/nixpkgs/labels?q=approvals+

Usage

set GITHUB_BOT_TOKEN or GITHUB_TOKEN to a github token with permissions to add labels

nix run

Reasoning

github doesn't have a way to show approvals made by non-committers.

i created this to give non-committers a way to help committers.

label-approved's People

Contributors

artturin avatar delroth avatar dependabot[bot] avatar mweinelt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

mweinelt delroth

label-approved's Issues

label_dict key=0 edge case

Looks like I hit an edge case, where approval_count was 0, which generally shouldn't be a problem.

INFO:root:Processing 213835
INFO:root:lastappdate: 2023-01-31 22:11:31
INFO:root:lastcommitdate: 2023-01-31 19:15:12
Traceback (most recent call last):
  File "/nix/store/i7bzfdg5alslnxr97qh7ia0zn6gh6sf8-label-approved-0.1.0/bin/.label-approved-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/i7bzfdg5alslnxr97qh7ia0zn6gh6sf8-label-approved-0.1.0/lib/python3.10/site-packages/label_approved/cli.py", line 147, in main
    label_to_add = label_dict[pr_object.new_label]
KeyError: 0

NixOS/nixpkgs#213835

Screenshot 2023-02-02 at 02-29-27 coursera-dl fix api version problems by binarin · Pull Request #213835 · NixOS_nixpkgs

With debug

DEBUG:urllib3.connectionpool:https://api.github.com:443 "GET /repos/NixOS/nixpkgs/issues/213835/labels HTTP/1.1" 200 None
DEBUG:github.Requester:GET https://api.github.com/repos/NixOS/nixpkgs/issues/213835/labels {'Authorization': 'token (oauth token removed)', 'User-Agent': 'PyGithub/Python'} None ==> 200 {'server': 'GitHub.com', 'date': 'Thu, 02 Feb 2023 01:27:28 GMT', 'content-type': 'application/json; charset=utf-8', 'transfer-encoding': 'chunked', 'cache-control': 'private, max-age=60, s-maxage=60', 'vary': 'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, X-Requested-With', 'etag': 'W/"b18bc22cbbf9444502d42f5d57d9894a74625a89b01eff3dd1df581ce0b67434"', 'last-modified': 'Wed, 01 Feb 2023 02:54:16 GMT', 'x-oauth-scopes': 'repo', 'x-accepted-oauth-scopes': 'repo', 'github-authentication-token-expiration': '2023-02-08 01:25:57 UTC', 'x-github-media-type': 'github.v3; format=json', 'x-github-api-version-selected': '2022-11-28', 'x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '3728', 'x-ratelimit-reset': '1675301677', 'x-ratelimit-used': '1272', 'x-ratelimit-resource': 'core', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset', 'access-control-allow-origin': '*', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 'x-frame-options': 'deny', 'x-content-type-options': 'nosniff', 'x-xss-protection': '0', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 'content-security-policy': "default-src 'none'", 'content-encoding': 'gzip', 'x-github-request-id': 'E7CC:37CE:18FD4:19825:63DB1180'} [{"id":731733923,"node_id":"MDU6TGFiZWw3MzE3MzM5MjM=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-linux:%201-10","name":"10.rebuild-linux: 1-10","color":"eeffee","default":false,"description":null},{"id":731735222,"node_id":"MDU6TGFiZWw3MzE3MzUyMjI=","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-darwin:%201-10","name":"10.rebuild-darwin: 1-10","color":"eeffee","default":false,"description":null},{"id":1955058051,"node_id":"MDU6TGFiZWwxOTU1MDU4MDUx","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-darwin:%201","name":"10.rebuild-darwin: 1","color":"ededed","default":false,"description":null},{"id":1955058054,"node_id":"MDU6TGFiZWwxOTU1MDU4MDU0","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/10.rebuild-linux:%201","name":"10.rebuild-linux: 1","color":"ededed","default":false,"description":null},{"id":4022792890,"node_id":"LA_kwDOAEVQ_M7vxvK6","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/12.approvals:%201","name":"12.approvals: 1","color":"0E8A16","default":false,"description":""},{"id":4061482046,"node_id":"LA_kwDOAEVQ_M7yFUw-","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/12.approved-by:%20package-maintainer","name":"12.approved-by: package-maintainer","color":"0E8A16","default":false,"description":""},{"id":4826074325,"node_id":"LA_kwDOAEVQ_M8AAAABH6gM1Q","url":"https://api.github.com/repos/NixOS/nixpkgs/labels/backport%20release-22.11","name":"backport release-22.11","color":"13DBD5","default":false,"description":"Backport PR automatically"}]
DEBUG:root:PrWithApprovals(p_r=PullRequest(title="coursera-dl: fix api version problems", number=213835), new_label=0, previous_label=1)

Restructure to be runnable as a GitHub action

There are several drawbacks to the current "crawling" approach used by this tool:

  • Easily runs into quota issues
  • Can't process more than the last 1K PRs by ID (due to GH search API limitations, maybe?)
  • High latency since the whole set of open PRs needs to be recrawled on every run

I suggest the following complementary mode of operation:

  • Add a mode to run only on one PR, whose ID is provided on the command line.
  • Add all the scaffolding to be able to run this tool as a GitHub action.
  • Register this action to run on PR review events on nixpkgs.

Happy to take care of this myself (want to share commit privileges / future maintenance? :p), I really just want this to finally happen automatically on nixpkgs.

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.