Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
fixed som files
  • Loading branch information
Nexos Creator committed Jul 17, 2024
1 parent cec63c0 commit da14732
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 96 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 0 additions & 47 deletions src/0-sequle-repo.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
14 changes: 0 additions & 14 deletions src/Release/published.ts

This file was deleted.

File renamed without changes.
46 changes: 19 additions & 27 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
import { Probot } from "probot";
//for issue
import { iopened, iclosed } from "./issue.js";
// for pull requst
import { propened, prclosed } from "./pull-request.js";
// import review from "./Pull Request/review.js";
// import merge from "./Pull Request/merge.js";
import changelog from "./Pull Request/changelog.js";
// for notification
import { issuenotify, pullnotify } from "./notify.js";
//for release
import published from "./Release/published.js";
import { IssueOpned, IssueClosed, labels } from "./issue.js";
import { PullOpned, PullClosed } from "./pull-request.js";
import { IssueNotify, PullNotify } from "./notify.js";
import draft from "./Release/draft.js";
import review from "./Pull Request/review.js";
import merge from "./Expirmental/merge.js";
import version from "./Release/version.js";
import changelog from "./changelog.js";

export default (app: Probot) => {

app.log.info("Yay, my app is loaded");

// issue
app.on("issues.opened", iopened);
app.on("issues.closed", iclosed);
app.on("issues.opened", IssueOpned);
app.on("issues.closed", IssueClosed);
app.on("issues.opened", labels);

// pull request
app.on("pull_request.opened", propened);
app.on("pull_request.closed", prclosed);
app.on("pull_request.opened", PullOpned);
app.on("pull_request.closed", PullClosed);
// review(app);
// merge(app);
changelog(app);
merge(app);

// notification
app.on("issues.opened", issuenotify);
app.on("pull_request.opened", pullnotify);
app.on("issues.opened", IssueNotify);
app.on("pull_request.opened", PullNotify);

// release
published(app);
draft(app);
review(app);

version(app);
changelog(app);

// expirement workflow
// Listen for issue and pull request comments
Expand All @@ -63,7 +55,7 @@ export default (app: Probot) => {
}
});

app.onAny(async (context) => {
app.log.info({ event: context.name });
});
app.onAny(async (context) => {
app.log.info({ event: context.name });
});
};
25 changes: 23 additions & 2 deletions src/issue.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//src/issue.ts

export const iclosed = async (context: any) => {
export const IssueClosed = async (context: any) => {
const issueComment = context.issue({ body: 'This issue has been closed.' });
await context.octokit.issues.createComment(issueComment);
};


export const iopened = async (context: any) => {
export const IssueOpned = async (context: any) => {
// When issue opned
const admin = context.payload.issue;
const issue = context.issue();
Expand All @@ -33,3 +33,24 @@ export const iopened = async (context: any) => {
});
await context.octokit.issues.createComment(issueComment);
};

export const labels = async (context: any) => {
const issue = context.issue();
const { title, body } = context.payload.issue;

// Example rules for labeling
const labels: string[] = [];
if (title.includes("bug") || body.includes("bug")) {
labels.push("bug");
}
if (title.includes("feature") || body.includes("feature")) {
labels.push("enhancement");
}

if (labels.length > 0) {
await context.octokit.issues.addLabels({
...issue,
labels,
});
}
};
4 changes: 2 additions & 2 deletions src/notify.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";

export const issuenotify = async (context: any) => {
export const IssueNotify = async (context: any) => {
const issue = context.payload.issue;
const { title, body, html_url } = issue;

Expand All @@ -16,7 +16,7 @@ export const issuenotify = async (context: any) => {
// await sendEmail("New Issue Opened", message);
};

export const pullnotify = async (context: any) => {
export const PullNotify = async (context: any) => {
const pr = context.payload.pull_request;
const { title, body, html_url } = pr;

Expand Down
4 changes: 2 additions & 2 deletions src/pull-request.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const propened = async (context: any) => {
export const PullOpned = async (context: any) => {
// When pull request opned
const sender = context.payload.pull_request.user.login;
const comment = context.issue({
Expand All @@ -8,7 +8,7 @@ export const propened = async (context: any) => {
await context.octokit.issues.createComment(comment);
};

export const prclosed = async (context: any) => {
export const PullClosed = async (context: any) => {
const pullRequest = context.payload.pull_request;

if (pullRequest.merged) {
Expand Down

0 comments on commit da14732

Please sign in to comment.