Turns out I do care about formatting a little. We have a lot of builders and chained methods.
I think it is easier to follow long chains when lined up veritcally.
This may be controversial but it we're doing it. Having code formatting needs to be consistent
and a non-issue during code review. I'm willing modify the configuration if people see a strong
need, but formatting needs to be present and enforced.
This change automatically turns off tests where we haven't had a chance to implement wiremocking.
They can still be run locally by setting test.github.useProxy (even though most of them do actually use the proxy).
- When we receive events from a webhook, it is non-trivial to determine which GitHub instance the event came from
or for that matter even if the event actually came from GitHub or GitHub Enterprise.
- In order to ensure that the logic for parsing events does not get replicated in clients, we need to be
able to call GitHub.parseEventPayload(Reader,Class) without knowing which GitHub the event originates from
and without the resulting objects triggering API calls back to a GitHub
- Thus we add GitHub.offline() to provide an off-line connection
- Thus we modify some of the object classes to return best-effort objects when off-line
- Add support for more of the event types into GHEventPayload
- Add tests of the event payload and accessing critical fields when using GitHub.offline()
- GHApiInfo need not be public because it's not publicly exposed.
- Throwing an exception is better IMO as it allows richer error message,
including the differentiation between unreachable host name vs wrong
URL, and reporting the API endpoint URL that was actually tried.
Using the Jenkins EnvInject or Credentials Binding Plugins its possible to
pass credentials as Environment Variables.
Its useful for Github.connect() to be able to directly read the values of the
'login', 'password' and 'oauth' properties directly from the environment.
This commit modifies the base Github.connect() method to resolve credentials
in two steps:
1. ~/.github credentials file if it exists.
2. login, password or oauth variables from the environment
A further fromEnvironment() method is provided to support
loading from non-standard variable names.
The old Github.connect() method would throw an IOException if the ~/.github file
did not exist. Now it will fail silently instead dropping back to the anonymous
users access level.
Added new unit tests into GitHubTest.