Skip to content

Commit

Permalink
🔧 Add automated issue creater
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 23, 2020
1 parent 70dea4d commit bff85b6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/automations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { readFile } from "fs-extra";
import { join } from "path";
import { Octokit } from "@octokit/rest";
import { config } from "dotenv";
config();

const createAutomatedIssue = async () => {
const octokit = new Octokit({
auth: process.env.AUTOMATION_TOKEN,
});
const body = await readFile(join(".", "src", "issue-template.md"), "utf8");
const owner = "AnandChowdhary";
const repo = "status";
try {
await octokit.issues.create({
owner,
repo,
title: "⚠️ Add `workflow` scope to your personal access token",
body: body.replace("{{TEAM}}", owner),
labels: ["bug", "upptime-automated"],
});
console.log("Created an issue in", owner, repo);
} catch (error) {
console.log("Got an error in creating this issue", error);
}
};
createAutomatedIssue();
2 changes: 1 addition & 1 deletion src/issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Related links:
- Issue for this change: [upptime/upptime#81](https://github.com/upptime/upptime/issues/81)
- Updated docs: https://upptime.js.org/docs/get-started#add-repository-secrets

<small>_Psst,_ this is an automated issue because of a breaking change you need to be aware of. Issues like this will be opened very infrequently (I promise no spam!). However, if you want to disable these completely, you can set `disableAutomatedIssues: true` in your `.upptimerc` configuration file, but note that you'll have to fix your breaking changes manually by reviewing the [upptime/upptime](https://github.com/upptime/upptime) repository. Thanks for using Upptime! — @AnandChowdhary</small>
<small>_Psst,_ this is an automated issue because of a breaking change you need to be aware of. Issues like this will be opened very infrequently (I promise no spam!). However, if you want to disable these completely, you can set `disableAutomatedIssues: true` in your `.upptimerc.yml` configuration file, but note that you'll have to fix your breaking changes manually by reviewing the [upptime/upptime](https://github.com/upptime/upptime) repository. Thanks for using Upptime! — @AnandChowdhary</small>

0 comments on commit bff85b6

Please sign in to comment.