Skip to content

Commit

Permalink
feat: Initialize status repo
Browse files Browse the repository at this point in the history
  • Loading branch information
colinjfw committed Aug 22, 2019
0 parents commit d0b67db
Show file tree
Hide file tree
Showing 6 changed files with 406 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:lts-alpine
RUN apk add --no-cache ca-certificates
COPY . /usr/app
WORKDIR /usr/app
RUN npm install
ENTRYPOINT ["node", "index.js"]
16 changes: 16 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Deliverybot Deployment Status'
description: 'Set the status of a deployment'
author: 'deliverybot'
inputs:
state:
description: 'Deployment status to set the action as'
default: 'pending'
token:
description: 'Github repository token'
log-url:
description: 'Log url location'
description:
description: 'Descriptive message about the deployment state'
runs:
using: 'docker'
image: 'Dockerfile'
27 changes: 27 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const core = require("@actions/core");
const github = require("@actions/github");

async function run() {
try {
const token = core.getInput("token", {required: true});
const state = core.getInput("state", {required: true});
const log_url = core.getInput("log-url", {required: false});
const description = core.getInput("description", {required: false});

const client = new github.GitHub(token);
const context = github.context;

await client.repos.createDeploymentStatus({
...context.repo,
deployment_id: context.payload.deployment.id,
state,
log_url,
description,
});
} catch (error) {
core.error(error);
core.setFailed(error.message);
}
}

run();
Loading

0 comments on commit d0b67db

Please sign in to comment.