Skip to content

Commit

Permalink
bump version to 1.0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
alexleventer committed May 11, 2020
1 parent 18fca94 commit 2ab08fd
Show file tree
Hide file tree
Showing 8,848 changed files with 2,139,922 additions and 1 deletion.
The diff you're trying to view is too large. We only load the first 3000 changed files.
56 changes: 56 additions & 0 deletions dist/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const github_1 = require("@actions/github");
const Octokit_1 = __importDefault(require("./integrations/Octokit"));
const dateUtils_1 = require("./utils/dateUtils");
const constants_1 = require("./constants");
exports.run = () => __awaiter(void 0, void 0, void 0, function* () {
try {
const githubToken = core.getInput('GH_TOKEN');
if (!githubToken) {
throw new Error('Missing GH_TOKEN environment variable');
}
const ok = new Octokit_1.default(githubToken);
const issues = yield ok.listAllOpenIssues(github_1.context.repo.owner, github_1.context.repo.repo);
const results = yield ok.getIssuesWithDueDate(issues);
results.forEach((issue) => __awaiter(void 0, void 0, void 0, function* () {
const daysUtilDueDate = yield dateUtils_1.datesToDue(issue.due);
if (daysUtilDueDate <= 7 && daysUtilDueDate > 0) {
yield ok.addLabelToIssue(github_1.context.repo.owner, github_1.context.repo.repo, issue.number, [constants_1.NEXT_WEEK_TAG_NAME]);
}
else if (daysUtilDueDate <= 0) {
yield ok.removeLabelFromIssue(github_1.context.repo.owner, github_1.context.repo.repo, constants_1.NEXT_WEEK_TAG_NAME, issue.number);
yield ok.addLabelToIssue(github_1.context.repo.owner, github_1.context.repo.repo, issue.number, [constants_1.OVERDUE_TAG_NAME]);
}
}));
return {
ok: true,
issuesProcessed: results.length,
};
}
catch (e) {
core.setFailed(e.message);
throw e;
}
});
exports.run();
4 changes: 4 additions & 0 deletions dist/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OVERDUE_TAG_NAME = 'Overdue';
exports.NEXT_WEEK_TAG_NAME = 'Due in next week';
91 changes: 91 additions & 0 deletions dist/integrations/Octokit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const github_1 = require("@actions/github");
const front_matter_1 = __importDefault(require("front-matter"));
const constants_1 = require("../constants");
class Octokit {
constructor(token) {
this.client = new github_1.GitHub(token);
}
listAllOpenIssues(owner, repo) {
return __awaiter(this, void 0, void 0, function* () {
const { data } = yield this.client.issues.listForRepo({
owner,
repo,
state: 'open',
});
return data;
});
}
get(owner, repo, issueNumber) {
return __awaiter(this, void 0, void 0, function* () {
const { data } = yield this.client.issues.get({
owner,
repo,
issue_number: issueNumber,
});
return data;
});
}
addLabelToIssue(owner, repo, issueNumber, labels) {
return __awaiter(this, void 0, void 0, function* () {
const { data } = yield this.client.issues.addLabels({
owner,
repo,
issue_number: issueNumber,
labels,
});
return data;
});
}
removeLabelFromIssue(owner, repo, name, issue_number) {
return __awaiter(this, void 0, void 0, function* () {
try {
const { data } = yield this.client.issues.removeLabel({
owner,
repo,
name,
issue_number,
});
return data;
}
catch (e) {
// Do not throw error
return [];
}
});
}
getIssuesWithDueDate(rawIssues) {
return __awaiter(this, void 0, void 0, function* () {
return rawIssues.filter(issue => {
// TODO: Move into utils
const meta = front_matter_1.default(issue.body);
const due = meta.attributes && (meta.attributes.due || meta.attributes.Due);
if (meta.attributes && due) {
return Object.assign(issue, { due });
}
});
});
}
getOverdueIssues(rawIssues) {
return __awaiter(this, void 0, void 0, function* () {
return rawIssues.filter(issue => {
const activeLabels = issue.labels.map(label => label.name);
return activeLabels.includes(constants_1.OVERDUE_TAG_NAME);
});
});
}
}
exports.default = Octokit;
23 changes: 23 additions & 0 deletions dist/integrations/Slack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const client_1 = require("@slack/client");
class Slack {
constructor(webhookUrl) {
this.webhook = new client_1.IncomingWebhook(webhookUrl);
}
postMessage(message) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.webhook.send(message);
});
}
}
exports.default = Slack;
11 changes: 11 additions & 0 deletions dist/utils/dateUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const moment_1 = __importDefault(require("moment"));
exports.datesToDue = (date) => {
const eventDate = moment_1.default(date);
const today = moment_1.default();
return eventDate.diff(today, 'days');
};
1 change: 1 addition & 0 deletions node_modules/.bin/acorn

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

1 change: 1 addition & 0 deletions node_modules/.bin/atob

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

1 change: 1 addition & 0 deletions node_modules/.bin/escodegen

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

1 change: 1 addition & 0 deletions node_modules/.bin/esgenerate

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

1 change: 1 addition & 0 deletions node_modules/.bin/esparse

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

1 change: 1 addition & 0 deletions node_modules/.bin/esvalidate

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

1 change: 1 addition & 0 deletions node_modules/.bin/import-local-fixture

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

1 change: 1 addition & 0 deletions node_modules/.bin/is-ci

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

1 change: 1 addition & 0 deletions node_modules/.bin/jest

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

1 change: 1 addition & 0 deletions node_modules/.bin/jest-runtime

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

1 change: 1 addition & 0 deletions node_modules/.bin/js-yaml

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

1 change: 1 addition & 0 deletions node_modules/.bin/jsesc

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

1 change: 1 addition & 0 deletions node_modules/.bin/json5

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

1 change: 1 addition & 0 deletions node_modules/.bin/mkdirp

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

1 change: 1 addition & 0 deletions node_modules/.bin/parser

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

1 change: 1 addition & 0 deletions node_modules/.bin/rimraf

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

1 change: 1 addition & 0 deletions node_modules/.bin/sane

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

1 change: 1 addition & 0 deletions node_modules/.bin/semver

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

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-conv

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

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-sign

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

1 change: 1 addition & 0 deletions node_modules/.bin/sshpk-verify

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

1 change: 1 addition & 0 deletions node_modules/.bin/ts-jest

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

1 change: 1 addition & 0 deletions node_modules/.bin/tsc

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

1 change: 1 addition & 0 deletions node_modules/.bin/tsserver

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

1 change: 1 addition & 0 deletions node_modules/.bin/uuid

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

1 change: 1 addition & 0 deletions node_modules/.bin/watch

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

1 change: 1 addition & 0 deletions node_modules/.bin/which

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

Loading

0 comments on commit 2ab08fd

Please sign in to comment.