Skip to content

Unexpected token 'var' #220

@tjbaker

Description

@tjbaker

I am trying to comment on a PR via a workflow and keep getting this exception:

SyntaxError: Unexpected token 'var'
    at new AsyncFunction (<anonymous>)
    at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v5/dist/index.js:4942:56)
    at main (/home/runner/work/_actions/actions/github-script/v5/dist/index.js:4997:26)
    at Module.272 (/home/runner/work/_actions/actions/github-script/v5/dist/index.js:4981:1)
Error: Unhandled error: SyntaxError: Unexpected token 'var'
    at __webpack_require__ (/home/runner/work/_actions/actions/github-script/v5/dist/index.js:24:31)
    at startup (/home/runner/work/_actions/actions/github-script/v5/dist/index.js:43:19)
    at /home/runner/work/_actions/actions/github-script/v5/dist/index.js:49:18
    at Object.<anonymous> (/home/runner/work/_actions/actions/github-script/v5/dist/index.js:52:10)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)

The code is really simple

      - name: Comment on PR
        uses: actions/github-script@v5
        if: failure()
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: "foo"
            })

Github support asked me to log a bug report here as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions