Initial commit

This commit is contained in:
James 2019-07-10 08:01:40 -06:00
parent eba30d4b85
commit 12f0aa1772
5 changed files with 5537 additions and 0 deletions

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
# Use the latest version of Node.js
#
# You may prefer the full image:
# FROM node
#
# or even an alpine image (a smaller, faster, less-feature-complete image):
# FROM node:alpine
#
# You can specify a version:
# FROM node:10-slim
FROM node:slim
# Labels for GitHub to read your action
LABEL "com.github.actions.name"="Zenhub Automations"
LABEL "com.github.actions.description"="Automate zenhub with ease"
# Here are all of the available icons: https://feathericons.com/
LABEL "com.github.actions.icon"="move"
# And all of the available colors: https://developer.github.com/actions/creating-github-actions/creating-a-docker-container/#label
LABEL "com.github.actions.color"="gray-dark"
# Copy the package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy the rest of your action's code
COPY . .
# Run `node /index.js`
ENTRYPOINT ["node", "/index.js"]

6
index.js Normal file
View File

@ -0,0 +1,6 @@
const { Toolkit } = require('actions-toolkit')
// Run your GitHub Action!
Toolkit.run(async tools => {
tools.exit.success('We did it!')
})

23
index.test.js Normal file
View File

@ -0,0 +1,23 @@
const { Toolkit } = require('actions-toolkit')
describe('Zenhub Automations', () => {
let action, tools
// Mock Toolkit.run to define `action` so we can call it
Toolkit.run = jest.fn((actionFn) => { action = actionFn })
// Load up our entrypoint file
require('.')
beforeEach(() => {
// Create a new Toolkit instance
tools = new Toolkit()
// Mock methods on it!
tools.exit.success = jest.fn()
})
it('exits successfully', () => {
action(tools)
expect(tools.exit.success).toHaveBeenCalled()
expect(tools.exit.success).toHaveBeenCalledWith('We did it!')
})
})

5462
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "zenhub-automations",
"private": true,
"main": "index.js",
"scripts": {
"start": "node ./index.js",
"test": "jest"
},
"dependencies": {
"actions-toolkit": "^2.1.0"
},
"devDependencies": {
"jest": "^24.5.0"
}
}