generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from gentlementlegen/feat/error-reporting
feat: errors are reported within the metadata of the Github comment
- Loading branch information
Showing
10 changed files
with
699 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Conversation rewards", | ||
"description": "Generate rewards for on topic conversation for closing issues as complete.", | ||
"ubiquity:listeners": [ "issues.closed" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import * as github from "@actions/github"; | ||
import { GithubCommentModule } from "../parser/github-comment-module"; | ||
|
||
export function getGithubWorkflowRunUrl() { | ||
return `${github.context.payload.repository?.html_url}/actions/runs/${github.context.runId}`; | ||
} | ||
|
||
const githubCommentModule = new GithubCommentModule(); | ||
|
||
export default githubCommentModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import * as core from "@actions/core"; | ||
import githubCommentModuleInstance, { getGithubWorkflowRunUrl } from "./helpers/github-comment-module-instance"; | ||
import logger from "./helpers/logger"; | ||
import { run } from "./run"; | ||
|
||
export default run() | ||
.then((result) => { | ||
core?.setOutput("result", result); | ||
return result; | ||
}) | ||
.catch((e) => { | ||
console.error("Failed to run comment evaluation:", e); | ||
core?.setFailed(e.toString()); | ||
.catch(async (e) => { | ||
const errorMessage = logger.error(`Failed to run comment evaluation. ${e}`, e); | ||
try { | ||
await githubCommentModuleInstance.postComment( | ||
`${errorMessage?.logMessage.diff}\n<!--\n${getGithubWorkflowRunUrl()}\n${JSON.stringify(errorMessage?.metadata, null, 2)}\n-->` | ||
); | ||
} catch (err) { | ||
logger.error(`Failed to update Github comment: ${err}`); | ||
} | ||
core?.setFailed(e); | ||
return e; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3315,7 +3315,7 @@ | |
ethers "6.11.1" | ||
libsodium-wrappers "^0.7.13" | ||
|
||
"@ubiquity-dao/rpc-handler@^1.1.0": | ||
"@ubiquity-dao/[email protected]": | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@ubiquity-dao/rpc-handler/-/rpc-handler-1.1.0.tgz#5a17e98de8c611ea19315ff946166b20d6f7f629" | ||
integrity sha512-EzbwAoHx+jPEymAdJbKt1O7C9RB/R3IWcBPRbDzFs8iBOuFktClsR8e95xvFrV9n2jTmr2ZHxpXE/rOLOEWfPA== | ||
|