Bug: "Close issues and notify" workflow fails for all PRs
sobolevn opened this issue · 1 comments
sobolevn commented
Description
Link: https://github.com/litestar-org/litestar/actions/runs/11360430637/job/31598175773
Report:
Run actions/github-script@v7
with:
script: const prNumber = context.payload.number
const branch = context.baseRef
# TODO: `develop` no longer exists. Need a new way to determine if the
# change will be introduced in a major, minor, or patch release.
# possibly conventional commit standards in the PR title or by labels?
const isDevelop = branch === "develop"
const commentBody = `<!--closing-comment-->\nThis issue has been closed in #${prNumber}. The change will be included in the upcoming ${isDevelop ? "minor" : "patch"} release.`
const query = `query($number: Int!, $owner: String!, $name: String!) { repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
id
closingIssuesReferences (first: 10) { edges { node { number } } }
}
}
}`
const res = await github.graphql(query, {number: prNumber, owner: context.repo.owner, name: context.repo.repo})
const linkedIssues = res.repository.pullRequest.closingIssuesReferences.edges.map(
edge => edge.node.number
)
for (const issueNumber of linkedIssues) {
const res = await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
state: "closed",
state_reason: "completed"
})
if (res.status === 200) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: commentBody,
})
}
}
github-token: ***
debug: false
user-agent: actions/github-script
result-encoding: json
retries: 0
retry-exempt-status-codes: 400,401,403,404,422
SyntaxError: Invalid or unexpected token
Error: Unhandled error: SyntaxError: Invalid or unexpected token
at new AsyncFunction (<anonymous>)
at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35424:16)
at main (/home/runner/work/_actions/actions/github-script/v7/dist/index.js:35522:26)
at /home/runner/work/_actions/actions/github-script/v7/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:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
I will fix it right now :)
URL to code causing the issue
No response
MCVE
No response
Steps to reproduce
No response
Screenshots
No response
Logs
No response
Litestar Version
main
Platform
- Linux
- Mac
- Windows
- Other (Please specify in the description above)
github-actions commented
This issue has been closed in #3811. The change will be included in upcoming releases.