GitHub Learning Lab Config: Unable to Debug Octokit Actions

I have a fairly simple course with the following steps using this octokit method:

https://octokit.github.io/rest.js/v18#pulls-list-files

steps:
  - title: step1
    description: do a thing
    link: '{{ repoUrl }}/pull/1'
    event: pull_request.synchronize
    actions:
        - type: respond
          with: debug.md
          data:
            debug: "pulls.listFiles( owner: %payload.repository.owner.login% , repo: %payload.repository.name% , pull_number:  %payload.number% )"
            message: "Fetching via Octokit?"

      - action_id: fileDiffList
        type: octokit
        method: pulls.listFiles
        owner: "%payload.repository.owner.login%"
        repo: "%payload.repository.name%"
        pull_number: "%payload.number%"
        store:
          firstPrDiffList: "%result%"

      - type: respond
        with: debug.md
        data:
          debug: "%store.firstPrDiffList%"

The last respond action does not seem to fire off at all on the pull request, nor is there any way on the admin dashboard to view any errors for my course (this course is currently just a draft). Unsure of anything that’s going on, I tried removing the first respond action.

I’m naively following @brianamarie 's example here: write-github-script/config.yml at 310602328e3c522e34aed3e7d3dd5361f33f2306 · githubtraining/write-github-script · GitHub

Not sure what I’m doing wrong, any help would be appreciated.

Oh and just in case it’s a common configuration error: I have installed GitHub labs and configured it so that it has access to all my repositories.

Hi @chr0n1x! I am not sure if you’ve already tried it, but https://smee.io/ may be a helpful tool for debugging. The video is a bit old, but I walk through this process here: https://youtu.be/nQ5oh9Et1As?t=1489

@brianamarie holy moly, I’ve been living under a rock cause I didn’t know that tool existed. Thank you, that’s incredibly helpful!

that being said, the issue itself isnt whether or not Im gating properly or if webhooks are coming through. Through trial-and-error I was able to get a simple debug message printing out. The issue is more that Im having a hard time debugging octokit actions like this one:

      # assume event: pull_request.synchronize here
      - action_id: fileDiffList
        type: octokit
        method: pulls.listFiles
        owner: "%payload.repository.owner.login%"
        repo: "%payload.repository.name%"
        pull_number: "%payload.number%"
        store:
          firstPrDiffList: "%result%"

Unless that action can be debugged using webhooks somehow? I didn’t see that in the video you linked.

Hi @chr0n1x! I don’t have an exact answer unfortunately. :frowning: But, here are some hints I got when I asked some of our internal teams:

  • Essentially, there are a few choices about how to debug: by using Actions, or by standing up a Node app.
  • It may be relevant to know that we are using "@octokit/rest": "^15.18.3", to find the right version of the docs. (The team is also looking into the possibility of updating this.)
1 Like

@brianamarie thanks for the reply! That’s good to know, the version of @octokit/rest that the app is using. If Im searching the repo right, it looks like the method that I was trying to use does not exist: Search · getFiles · GitHub

:frowning: