-
Notifications
You must be signed in to change notification settings - Fork 540
-
Hi!
In this block of code I'm getting an error in GitHub workflow
-
name: Create GitHub Issue
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GitHub_TOKEN }}
script: |
const fs = require('fs');
const emailContents = fs.readFileSync('/home/runner/work/demo_test/demo_test/scripts/email_contents.txt', 'utf8');
const issueTitle = 'New Issue from Email';
const issueBody = 'emailContents';async function createGitHubIssue() { # Create an issue using the GitHub API const response = await github.issues.create({ owner: 'context.repo.owner', repo: 'context.repo.repo', title: 'issueTitle', body: 'issueBody' }); console.log('Issue created:', response.data); } createGitHubIssue() user-agent: actions/github-script result-encoding: json debug: false retries: 0 retry-exempt-status-codes: 400,401,403,404,422
Error :
Run actions/github-script@v6
SyntaxError: Invalid or unexpected token
at new AsyncFunction ()
at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15143:16)
at main (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15236:26)
at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:15217:1
at /home/runner/work/_actions/actions/github-script/v6/dist/index.js:15268:3
at Object. (/home/runner/work/_actions/actions/github-script/v6/dist/index.js:15271:12)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
Error: Unhandled error: SyntaxError: Invalid or unexpected token
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
Thanks
Beta Was this translation helpful? Give feedback.