generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 28
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 #52 from gentlementlegen/development
feat: waiting message is displayed at the beginning of the run
- Loading branch information
Showing
17 changed files
with
123 additions
and
76 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
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ jobs: | |
- uses: googleapis/release-please-action@v4 | ||
with: | ||
release-type: simple | ||
target-branch: main |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { GithubCommentModule } from "../parser/github-comment-module"; | ||
|
||
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
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 @@ | ||
import { Logs } from "@ubiquity-dao/ubiquibot-logger"; | ||
|
||
const logger = new Logs("debug"); | ||
|
||
export default logger; |
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 |
---|---|---|
@@ -1,43 +1,32 @@ | ||
import { getSortedPrices } from "./helpers/label-price-extractor.ts"; | ||
import configuration from "./configuration/config-reader"; | ||
import githubCommentModuleInstance from "./helpers/github-comment-module-instance"; | ||
import { getSortedPrices } from "./helpers/label-price-extractor"; | ||
import logger from "./helpers/logger"; | ||
import { IssueActivity } from "./issue-activity"; | ||
import program from "./parser/command-line"; | ||
import { Processor } from "./parser/processor"; | ||
import { parseGitHubUrl } from "./start"; | ||
import { getOctokitInstance } from "./get-authentication-token.ts"; | ||
import configuration from "./configuration/config-reader.ts"; | ||
|
||
export async function run() { | ||
const { eventPayload, eventName } = program; | ||
if (eventName === "issues.closed") { | ||
if (eventPayload.issue.state_reason !== "completed") { | ||
const result = "# Issue was not closed as completed. Skipping."; | ||
await getOctokitInstance().issues.createComment({ | ||
body: `\`\`\`text\n${result}\n\`\`\``, | ||
repo: eventPayload.repository.name, | ||
owner: eventPayload.repository.owner.login, | ||
issue_number: eventPayload.issue.number, | ||
}); | ||
return result; | ||
const result = logger.info("Issue was not closed as completed. Skipping."); | ||
await githubCommentModuleInstance.postComment(result?.logMessage.diff || ""); | ||
return result?.logMessage.raw; | ||
} | ||
const issue = parseGitHubUrl(eventPayload.issue.html_url); | ||
const activity = new IssueActivity(issue); | ||
await activity.init(); | ||
if (configuration.incentives.requirePriceLabel && !getSortedPrices(activity.self?.labels).length) { | ||
const result = "! No price label has been set. Skipping permit generation."; | ||
await getOctokitInstance().issues.createComment({ | ||
body: `\`\`\`text\n${result}\n\`\`\``, | ||
repo: eventPayload.repository.name, | ||
owner: eventPayload.repository.owner.login, | ||
issue_number: eventPayload.issue.number, | ||
}); | ||
return result; | ||
const result = logger.error("No price label has been set. Skipping permit generation."); | ||
await githubCommentModuleInstance.postComment(result?.logMessage.diff || ""); | ||
return result?.logMessage.raw; | ||
} | ||
const processor = new Processor(); | ||
await processor.run(activity); | ||
return processor.dump(); | ||
} else { | ||
const result = `${eventName} is not supported, skipping.`; | ||
console.warn(result); | ||
return result; | ||
return logger.error(`${eventName} is not supported, skipping.`)?.logMessage.raw; | ||
} | ||
} |
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
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
Oops, something went wrong.