Skip to content

README "Usage with Octokit" example creates errors, omits info when used with GitHub App #407

@Dottenpixel

Description

@Dottenpixel

I'm using the example code in the README verbatim try to use my GitHub App to run a node script in a GitHub Action job. The example under the Usage with Octokit README header is :

const { slug } = await appOctokit.request("GET /user");
                 ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

After some professional Googling, I found that wrapping the await line in an anonymous async function is the way to go. When I do that I then get this error:

Error: [@octokit/auth-app] installationId option is required for installation authentication.
    at getInstallationAuthentication (/home/runner/work/design-system-internal/design-system-internal/node_modules/@octokit/auth-app/dist-node/index.js:131:11)
    at hook (/home/runner/work/design-system-internal/design-system-internal/node_modules/@octokit/auth-app/dist-node/index.js:359:13)
    at /home/runner/work/design-system-internal/design-system-internal/node_modules/@octokit/plugin-request-log/dist-node/index.js:[18](https://github.com/salesforce-ux/design-system-internal/actions/runs/3285141382/jobs/5411912194#step:8:19):12
    at /home/runner/work/design-system-internal/design-system-internal/node_modules/before-after-hook/lib/register.js:25:15
    at async /home/runner/work/design-system-internal/design-system-internal/gh-app-auth.js:24:30

The README doesn't include any mention of adding an installationId under that header. Can we get the README updated to display a working GitHub App example with Octokit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions