Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add audit_log endpoint with tests #1481

Merged
merged 2 commits into from
Sep 12, 2022

Conversation

Brend-Smits
Copy link
Contributor

This should close #1478
Please do let me know how to improve this pull request further.

Signed-off-by: Brend Smits brend.smits@philips.com

Signed-off-by: Brend Smits <brend.smits@philips.com>
Copy link
Contributor

@timrogers timrogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for taking the time to put this pull request together ❤️ This looks great, apart from one tiny change.

lib/octokit/client/organizations.rb Outdated Show resolved Hide resolved
Signed-off-by: Brend Smits <brend.smits@philips.com>

Co-authored-by: Tim Rogers <timrogers@github.com>
@@ -0,0 +1 @@
{"http_interactions":[{"request":{"method":"get","uri":"https://api.github.com/orgs/api-playground/audit-log?include=all&phrase=action:org.add_member%20created:%3E2022-08-29","body":{"encoding":"US-ASCII","base64_string":""},"headers":{"Accept":["application/vnd.github.v3+json"],"User-Agent":["Octokit Ruby Gem 5.4.0"],"Content-Type":["application/json"],"Authorization":["token <<ACCESS_TOKEN>>"],"Accept-Encoding":["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"Server":["GitHub.com"],"Date":["Thu, 08 Sep 2022 09:46:38 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/\"b3452f345082e67e0b56ebea9a8eb8a079d51bebf854b03ad5087fcdc011f276\""],"X-Oauth-Scopes":["admin:org, repo:org, write:org"],"X-Accepted-Oauth-Scopes":["admin:org, read:org, write:org"],"Github-Authentication-Token-Expiration":["2022-09-08 22:00:00 UTC"],"X-Github-Media-Type":["github.v3; format=json"],"X-Ratelimit-Limit":["5000"],"X-Ratelimit-Remaining":["4991"],"X-Ratelimit-Reset":["1662630565"],"X-Ratelimit-Used":["9"],"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'"],"X-Github-Request-Id":["4133:295B:16ADE1C:17110CD:6319B9FE"]},"body":{"encoding":"ASCII-8BIT","base64_string":"WwogICAgewogICAgICAgICJhY3RvciI6ICJvY3Rva2l0IiwKICAgICAgICAiY3JlYXRlZF9hdCI6IDE2NjE4MzY2MTA2NjIsCiAgICAgICAgIm9yZyI6ICJjb2RlZm9yYW1lcmljYSIsCiAgICAgICAgInBlcm1pc3Npb24iOiAicmVhZCIsCiAgICAgICAgIkB0aW1lc3RhbXAiOiAxNjYxODM2NjEwNjYyLAogICAgICAgICJidXNpbmVzcyI6ICJjb2RlZm9yYW1lcmljYSIsCiAgICAgICAgInVzZXIiOiAibmV3LW9jdG9raXQiLAogICAgICAgICJhY3Rpb24iOiAib3JnLmFkZF9tZW1iZXIiLAogICAgICAgICJfZG9jdW1lbnRfaWQiOiAiREtqVWR2aVRBcTViU0cxVEdtOGxjQSIsCiAgICAgICAgIm9wZXJhdGlvbl90eXBlIjogImNyZWF0ZSIKICAgIH0KXQ=="}},"recorded_at":"Thu, 08 Sep 2022 09:46:38 GMT"}],"recorded_with":"VCR 6.1.0"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you have to do to get this cassette to generate successfully? I've been trying to get this working in my local development environment for a while and I've been struggling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What issues are you running into?

What I did is the following:

  • Get a token for the test organization
  • Make sure recordings are enabled to generate the cassette.
  • Trigger the test to save the cassette.
  • Manually edit the cassette to ensure no private data is included. I ran it across a Philips test organization... not really ideal, but I didn't know how to otherwise do it.
    • While manually editing the cassette, I had to decode the base64 ASCI II string to edit the values, and encode it back to base64 ASCI II string. It's a bit clunky, but I suppose it works?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What did you have to do to make sure that recording was enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timrogers timrogers merged commit 3e821a5 into octokit:main Sep 12, 2022
@timrogers
Copy link
Contributor

Thanks again for the contribution! This has been released in v5.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Audit log REST API
2 participants