Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: deliverybot/deliverybot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.5.3-6
Choose a base ref
...
head repository: deliverybot/deliverybot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.6.0
Choose a head ref
  • 5 commits
  • 9 files changed
  • 1 contributor

Commits on Nov 25, 2019

  1. Copy the full SHA
    b868f14 View commit details

Commits on Dec 18, 2019

  1. chore: Rename to deploybot

    colinjfw committed Dec 18, 2019
    Copy the full SHA
    fac961f View commit details
  2. feat: Implement a publish method

    Allows for controlling where new events go from the automatic
    deployments.
    colinjfw committed Dec 18, 2019
    Copy the full SHA
    036dc49 View commit details
  3. chore(release): 0.5.3

    colinjfw committed Dec 18, 2019
    Copy the full SHA
    7d34336 View commit details
  4. chore(release): 0.6.0

    colinjfw committed Dec 18, 2019
    Copy the full SHA
    ca46408 View commit details
Showing with 36 additions and 11 deletions.
  1. +1 −0 .npmrc
  2. +14 −0 CHANGELOG.md
  3. +1 −1 README.md
  4. +3 −3 package.json
  5. +7 −2 src/app.ts
  6. +6 −3 src/auto.ts
  7. +1 −1 src/index.ts
  8. +2 −0 test/auto.test.ts
  9. +1 −1 test/factory.ts
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://npm.pkg.github.com/deliverybot
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.6.0](https://github.com/deliverybot/deploybot/compare/v0.5.3-6...v0.6.0) (2019-12-18)


### Features

* Implement a publish method ([036dc49](https://github.com/deliverybot/deploybot/commit/036dc49))

### [0.5.3](https://github.com/deliverybot/deploybot/compare/v0.5.3-6...v0.5.3) (2019-12-18)


### Features

* Implement a publish method ([036dc49](https://github.com/deliverybot/deploybot/commit/036dc49))

### [0.5.3-6](https://github.com/deliverybot/deliverybot/compare/v0.5.3-5...v0.5.3-6) (2019-11-24)


2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# deliverybot
# deploybot

Complete deployment automation for GitHub. https://deliverybot.dev

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deliverybot",
"version": "0.5.3-6",
"name": "@deliverybot/deploybot",
"version": "0.6.0",
"main": "lib/index.js",
"files": [
"lib/*",
@@ -12,7 +12,7 @@
"author": "Deliverybot <support@deliverybot.dev> (https://github.com/deliverybot/deliverybot)",
"license": "MIT",
"support": "support@deliverybot.dev",
"repository": "https://github.com/deliverybot/deliverybot.git",
"repository": "https://github.com/deliverybot/deploybot",
"homepage": "https://deliverybot.dev",
"documentation": "https://deliverybot.dev/docs/",
"bugs": "https://github.com/deliverybot/deliverybot/issues",
9 changes: 7 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -3,13 +3,18 @@ import { prDeploy } from "./pr-deploy";
import { auto } from "./auto";
import { Application } from "probot";
import { LockStore, WatchStore } from "./store";
import Webhooks from "@octokit/webhooks";

/**
* Instantiates all the components of the app with it's dependencies.
*/
export function app(
application: Application,
lockStore: LockStore,
watchStore: WatchStore
watchStore: WatchStore,
publish: (event: Webhooks.WebhookEvent<any>) => Promise<any>
) {
prClose(application);
prDeploy(application, lockStore);
auto(application, lockStore, watchStore);
auto(application, lockStore, watchStore, publish);
}
9 changes: 6 additions & 3 deletions src/auto.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { config, deploy } from "./deploy";
import { hash } from "./util";
import { v4 as uuid } from "uuid";
import { PayloadRepository } from "@octokit/webhooks";
import Webhooks from "@octokit/webhooks";

export function match(auto: string | undefined, ref: string) {
if (!auto) return false;
@@ -22,7 +23,8 @@ export function match(auto: string | undefined, ref: string) {
export function auto(
app: Application,
lockStore: LockStore,
watchStore: WatchStore
watchStore: WatchStore,
publish: (event: Webhooks.WebhookEvent<any>) => Promise<any>
) {
/**
* Add watch adds a watch on a specific ref, sha and repository.
@@ -214,6 +216,7 @@ export function auto(
repoId,
sha,
watches: watches.map(w => ({
target: w.target,
id: w.id,
ref: w.ref,
sha: w.sha,
@@ -224,8 +227,8 @@ export function auto(
);
await Promise.all(
watches.map(watch =>
app.receive({
id: context.id,
publish({
id: uuid(),
name: "push_watch",
payload: {
...watch,
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -4,5 +4,5 @@ import { app } from "./app";

export = (application: Application) => {
const store = new InMemStore();
app(application, store, store);
app(application, store, store, application.receive.bind(application));
};
2 changes: 2 additions & 0 deletions test/auto.test.ts
Original file line number Diff line number Diff line change
@@ -27,9 +27,11 @@ describe("auto", () => {
["refs/heads/*", "refs/heads/master"],
["refs/*", "refs/tags/simple-tag"],
["refs/tags/*", "refs/tags/simple-tag"],
["refs/tags/v*", "refs/tags/v1.2.3"],
];
const unmatched = [
["refs/heads/staging", "refs/heads/master"],
["refs/tags/v", "refs/tags/v1.2.3"],
["refs/heads/*", "refs/tags/simple-tag"],
];

2 changes: 1 addition & 1 deletion test/factory.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ export const deliverybot = (application: Application) => {
// Assign plain octokit to remove the plugins (like retries) the GitHub adds
// by default.
application['Octokit'] = Octokit;
app(application, store, store);
app(application, store, store, application.receive.bind(application));
};