Skip to content

Commit

Permalink
Adding clarification for scripts that fail when PAT's aren't authoriz…
Browse files Browse the repository at this point in the history
…ed (MoCo-GHE-Admin#143)

* Adding clarification for scripts that fail when PAT's aren't authorized

* Bump setuptools from 67.6.1 to 70.0.0 (MoCo-GHE-Admin#144)

Bumps [setuptools](https://github.com/pypa/setuptools) from 67.6.1 to 70.0.0.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](pypa/setuptools@v67.6.1...v70.0.0)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Better error outputting making it clear you're dealing with errors

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Chris Knowles <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent e6779ae commit b19fdd0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions org_audit_licensefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ def main():
"file": "",
"type": "NO LICENSE DETECTED",
}
except gh_exceptions.ForbiddenError as err:
print(f"Error: {err}")
sys.exit()
else:
linedict = {
"org": f"{repo.owner}",
Expand Down
2 changes: 2 additions & 0 deletions org_dependency_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def run_query(org, repo, headers, url):
raise Exception(
f"Query failed to run by returning code of" f" {request.status_code}. {query}"
)
if "errors" in jsonified.keys():
raise Exception(f"Error: {jsonified['errors'][0]['message']}")
try:
has_next_page = next_page(jsonified)
cursor = get_cursor(jsonified)
Expand Down
3 changes: 3 additions & 0 deletions org_repo_perms.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ def main():
resultdict[repo] = {}
query = make_query(args.org, repo, cursor)
result = requests.post(url=args.url, json={"query": query}, headers=headers)
result_json = result.json()
if result.status_code != 200:
raise Exception(
f"Query failed to run by returning code of"
f" {result.status_code}. {query}"
)
if "errors" in result_json.keys():
raise Exception(f"Error: {result_json['errors'][0]['message']}")
resultdict[repo].update(
parse_user_data(
result.json()["data"]["repository"]["collaborators"]["edges"], args.all
Expand Down

0 comments on commit b19fdd0

Please sign in to comment.