Skip to content

Checks api functionality broken by recent github api change #1156

Closed

Description

@hcoles

Since 26/05 previously working calls to createCheckRun fail with the following error when trying to parse the github response

Cannot deserialize value of type `org.kohsuke.github.GHEvent` from String "discussion": not one of the values accepted for Enum class: [GOLLUM, ALL, INTEGRATION_INSTALLATION_REPOSITORIES, META, DOWNLOAD, FORK_APPLY, CHECK_RUN, MARKETPLACE_PURCHASE, PROJECT_CARD, SCHEDULE, PUSH, PAGE_BUILD, TEAM_ADD, REPOSITORY_VULNERABILITY_ALERT, PACKAGE, UNKNOWN, DELETE, DEPLOYMENT_STATUS, WATCH, FOLLOW, ORG_BLOCK, ORGANIZATION, COMMIT_COMMENT, ISSUE_COMMENT, REPOSITORY_IMPORT, GITHUB_APP_AUTHORIZATION, CODE_SCANNING_ALERT, CHECK_SUITE, FORK, GIST, CONTENT_REFERENCE, REPOSITORY, INSTALLATION_REPOSITORIES, REPOSITORY_DISPATCH, MILESTONE, STAR, LABEL, MEMBERSHIP, SECURITY_ADVISORY, PROJECT_COLUMN, TEAM, PULL_REQUEST_REVIEW, RELEASE, PUBLIC, WORKFLOW_RUN, STATUS, PULL_REQUEST, PROJECT, WORKFLOW_DISPATCH, CREATE, MEMBER, REGISTRY_PACKAGE, INSTALLATION, DEPLOYMENT, PULL_REQUEST_REVIEW_COMMENT, DEPLOY_KEY, PING, ISSUES]

It isn't instantly obvious to me how the full github response can be logged, but a little debugging suggests that gh events now include 'DISCUSSION' and 'DISCUSSION_COMMENT'.

Unfortunately I think there have been further changes. Patching the enum to include these values moves things further, but calls to

   repo.updateCheckRun(checkRun.getId())
      .add(output)
      .withConclusion(GHCheckRun.Conclusion.SUCCESS)
      .withStatus(GHCheckRun.Status.COMPLETED)
      .create();

Now fail with

org.kohsuke.github.GHFileNotFoundException: https://api.github.com/repos/ORG/REPO/check-runs/2675563029 {"message":"Not Found","documentation_url":"https://docs.github.com/rest"}

The check id is presumably correct as it was returned from the successful createCheckRun call, and this code previously functioned.

I think authentication is also affected. From memory, I was previously able to run adhoc tests of api calls using a personal access token. I now get a message saying that I must authenticate as a github app in order to use the checks api.

Activity

  1. gsmet commented on May 26, 2021

    @gsmet
    Contributor

    @hcoles the 404 looks like an authentication issue. Maybe related to the issue I opened yesterday #1155 ?

  2. gsmet commented on May 26, 2021

    @gsmet
    Contributor

    @hcoles do you have a proper stacktrace for the first issue?

  3. sathishavm commented on May 26, 2021

    @sathishavm

    I too face the same issue.
    Stack Trace

    42 common frames omitted\nCaused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of typeorg.kohsuke.github.GHEventfrom String \"discussion\": not one of the values accepted for Enum class: [GOLLUM, ALL, INTEGRATION_INSTALLATION_REPOSITORIES, META, DOWNLOAD, FORK_APPLY, CHECK_RUN, MARKETPLACE_PURCHASE, PROJECT_CARD, PUSH, PAGE_BUILD, TEAM_ADD, REPOSITORY_VULNERABILITY_ALERT, PACKAGE, DELETE, DEPLOYMENT_STATUS, WATCH, FOLLOW, ORG_BLOCK, ORGANIZATION, COMMIT_COMMENT, ISSUE_COMMENT, REPOSITORY_IMPORT, GITHUB_APP_AUTHORIZATION, CODE_SCANNING_ALERT, CHECK_SUITE, FORK, GIST, CONTENT_REFERENCE, REPOSITORY, INSTALLATION_REPOSITORIES, REPOSITORY_DISPATCH, MILESTONE, STAR, LABEL, MEMBERSHIP, SECURITY_ADVISORY, PROJECT_COLUMN, TEAM, PULL_REQUEST_REVIEW, RELEASE, PUBLIC, WORKFLOW_RUN, STATUS, PULL_REQUEST, PROJECT, WORKFLOW_DISPATCH, CREATE, MEMBER, REGISTRY_PACKAGE, INSTALLATION, DEPLOYMENT, PULL_REQUEST_REVIEW_COMMENT, DEPLOY_KEY, PING, ISSUES]\n at [Source: (String)\"{\"total_count\":1,\"check_runs\":[{\"id\":1704158257,\"node_id\":\"MDg6Q2hlY2tSdW4xNzA0MTU4MjU3\",\"head_sha\":\"fe643ea80de68b09ab57213e97a55f06ae7ec76d\",\"external_id\":\"ca395085-040a-526b-2ce8-bdc85f692774\",\"url\":\"https://api.github.com/repos/zendesk/popcorn_manifests/check-runs/1704158257\",\"html_url\":\"https://github.com/zendesk/popcorn_manifests/runs/1704158257\",\"details_url\":\"https://github.com/zendesk/popcorn_manifests/runs/1704158257\",\"status\":\"completed\",\"conclusion\":\"success\",\"started_at\":\"2021-01-14\"[truncated 2353 chars]; line: 1, column: 2482] (through reference chain: org.kohsuke.github.GHCheckRunsPage[\"check_runs\"]->java.lang.Object[][0]->org.kohsuke.github.GHCheckRun[\"app\"]->org.kohsuke.github.GHApp[\"events\"]->java.util.ArrayList[6])\n\tat com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)\n\tat com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1676)\n\tat com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue(DeserializationContext.java:932)\n\tat com.fasterxml.jackson.databind.deser.std.EnumDeserializer._deserializeAltString(EnumDeserializer.java:255)\n\tat com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize(EnumDeserializer.java:179)\n\tat com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)\n\tat com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)\n\tat com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)\n\tat com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)\n\tat com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:369)\n\tat com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)\n\tat com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)\n\tat com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:369)\n\tat com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)\n\tat com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)\n\tat com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)\n\tat com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138)\n\tat com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)\n\tat com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)\n\tat com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1719)\n\tat com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1261)\n\tat org.kohsuke.github.GitHubResponse.parseBody(GitHubResponse.java:96)\n\tat org.kohsuke.github.GitHubPageIterator.lambda$fetch$0(GitHubPageIterator.java:145)\n\tat org.kohsuke.github.GitHubClient.createResponse(GitHubClient.java:455)\n\tat org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:406)\n\t...

  4. hcoles commented on May 26, 2021

    @hcoles
    Author

    @gsmet Not sure if it's of much use, but there is a stacktrace in this action output.

    https://github.com/GroupCDG-Labs/pitest-github-demo/runs/2674168429?check_suite_focus=true

    As for the 404, just retried with a fork based on github-api-1.122 (had previously used the latest state of main) and everything works fine once the values are added to the enum.

    Is that constistent with this being a symtom of #1155?

    I authenticate as follows

          GitHub github = new GitHubBuilder()
            .withOAuthToken(credentials.token())
            .withEndpoint(credentials.baseUrl())
            .build();
    

    Where the token and url are sourced from the github action environment.

  5. sathishavm commented on May 26, 2021

    @sathishavm

    What is the workaround for this issue?, I am trying to fetch the check runs using api

  6. gsmet commented on May 26, 2021

    @gsmet
    Contributor

    I'll have a look at the enum issue this evening.

    The authentication issue looks different from #1155. I would create a separate issue for it with as many details as possible.

  7. gsmet commented on May 27, 2021

    @gsmet
    Contributor

    @hcoles @sathishavm maybe you can give #1159 a try?

  8. hcoles commented on May 27, 2021

    @hcoles
    Author

    @gsmet Yes, the first call passes with this change (although I'm still blocked by #1157 so can't test anyfurther).

    Also runs with the new enum values removed, so the more forgiving parsing works (excellent idea).

  9. hcoles commented on Jun 2, 2021

    @hcoles
    Author

    @gsmet @bitwiseman Thanks for fixing this, do you know when it will be released?

  10. bitwiseman commented on Jun 2, 2021

    @bitwiseman
    Member

    Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions