404 error while updating a check-run

Hi,

I try to do something similar to what is provided by the node action from yuzutech : annotations-action but with others technologies such as kotlin scripts.

All the requests are performed by using the java fuel library and they all use the GITHUB_TOKEN provided on a workflow run.
I use GitHub Enterprise Server 3.0.5.

To create a new check-run, the following code works fine :

    Fuel.post("$gitHubApiUrl/repos/$gitHubRepository/check-runs")
        .authentication()
        .basic(gitHubUserLogin, ciToken)
        .header("Accept", "application/vnd.github.v3+json")
        .body("""
              { "name" : "$name",
                "head_sha" : "$gitReference",
                "status" : "in_progress"
              }
            """)
        .responseJson()

after this step, the check-run is created and I would like to update it.

    Fuel.patch("$gitHubApiUrl/repos/$gitHubRepository/check-runs/${checkRunId}")
        .authentication()
        .basic(gitHubUserLogin, ciToken)
        .header("Accept", "application/vnd.github.v3+json")
        .header("Content-Type", "application/json")
        .body(checkRunPatch.toString().trimIndent())
        .responseString()

the equivalent curl command is :

curl -i -X PATCH -d “{“conclusion”:“success”,“status”:“completed”}” -H “Accept:application/vnd.github.v3+json” -H “Content-Type:application/json” -H “Authorization:Basic ***” https://{our github server}/api/v3/repos/Studio/initializr/check-runs/7682.

The id 7682 is the id of the newly created check-run.

The response for this request is a 404 :
Body : {“message”:“Not Found”,“documentation_url”:“https://docs.github.com/enterprise/3.0/rest”}

Before the update, a get request is able to return the newly created check-run :

    Fuel.get("$gitHubApiUrl/repos/$gitHubRepository/check-runs/$checkRunId")
        .authentication()
        .basic(gitHubUserLogin, ciToken)
        .header("Accept", "application/vnd.github.v3+json")
        .responseJson()

The patch request seems to be okay regarding the API spec : Checks - GitHub Docs.

I cannot see what’s wrong with this request and I definitively needs some help :slight_smile:

1 Like

The issue in on Fuel’s side : it seems that instead of performing a patch request, it does a post request with X-HTTP-Method-Override: PATCH header => PATCH method transformed to POST method · Issue #274 · kittinunf/fuel · GitHub.

1 Like