Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github workflow encounters "createComment is not a function" when run on PRs #205

Closed
neubig opened this issue Oct 31, 2024 · 3 comments
Closed

Comments

@neubig
Copy link
Contributor

neubig commented Oct 31, 2024

When the openhands-resolver.yml or openhands-resolver-experimental.yml workflows are run on PRs, they encounter an error github.rest[endpoint].createComment is not a function. The workflows should be modified to do the appropriate behavior on PRs.

Run actions/github-script@v7
  with:
    github-token: ***
    script: const issueType = process.env.ISSUE_TYPE;
  const endpoint = issueType === 'pr' ? 'pulls' : 'issues';
  github.rest[endpoint].createComment({
    issue_number: 196,
    owner: context.repo.owner,
    repo: context.repo.repo,
    body: `OpenHands started fixing the ${issueType}! You can monitor the progress [here](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).`
  });
  
    debug: false
    user-agent: actions/github-script
    result-encoding: json
    retries: 0
    retry-exempt-status-codes: 400,401,403,404,4[2](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:2)2
  env:
    pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:3).12.7/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.7/x6[4](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:4)/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.7/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.7/x64/lib
    ISSUE_NUMBER: 196
    ISSUE_TYPE: pr
TypeError: github.rest[endpoint].createComment is not a function
    at eval (eval at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:3[5](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:5)424:16), <anonymous>:5:23)
    at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35425:12)
    at main (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35522:2[6](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:6))
    at /home/runner/work/_actions/actions/github-script/v[7](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:7)/dist/index.js:35497:1
    at /home/runner/work/_actions/actions/github-script/v7/dist/index.js:35553:3
    at Object.<anonymous> (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35556:12)
    at Module._compile (node:internal/modules/cjs/loader:135[8](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:8):14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:[10](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:10))
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:[12](https://github.com/All-Hands-AI/openhands-resolver/actions/runs/11604865608/job/32314325102?pr=196#step:6:12))
Error: Unhandled error: TypeError: github.rest[endpoint].createComment is not a function
Copy link

OpenHands started fixing the issue! You can monitor the progress here.

Copy link

The workflow to fix this issue encountered an error. Please check the workflow logs for more information.

@neubig
Copy link
Contributor Author

neubig commented Oct 31, 2024

Fixed by #206

@neubig neubig closed this as completed Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant