-
-
Save decathorpe/9d128982cb00e2d345d9e397372538ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Add @rust-sig group with "commit" access to one or multiple packages | |
# Script accepts package names as command line arguments (and strips "," | |
# characters from arguments, so copy-pasting comma-separated lists of package | |
# names from report emails is supported, as well). | |
import sys | |
import requests | |
TOKEN = "PASTE-YOUR-src.fedoraproject.org-TOKEN-with-Modify-an-existing-project-access-HERE" | |
def main(): | |
packages = [package.strip(",") for package in sys.argv[1:]] | |
for package in packages: | |
print(f" - adding @rust-sig to {package} ...") | |
url = f"https://src.fedoraproject.org/api/0/rpms/{package}/git/modifyacls" | |
data = { | |
"user_type": "group", | |
"name": "rust-sig", | |
"acl": "commit", | |
} | |
headers = { | |
"Authorization": f"token {TOKEN}", | |
"Content-Type": "application/x-www-form-urlencoded", | |
} | |
response = requests.post(url, data=data, headers=headers) | |
response.raise_for_status() | |
return 0 | |
if __name__ == "__main__": | |
exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment