Skip to content

Commit

Permalink
fastlane-env-reminder is delivered as a container and run with dock…
Browse files Browse the repository at this point in the history
…er (#19)
  • Loading branch information
mollyIV authored Nov 19, 2019
1 parent d900ecd commit dd8bb80
Show file tree
Hide file tree
Showing 10 changed files with 782 additions and 1,280 deletions.
3 changes: 2 additions & 1 deletion fastlane-env-reminder/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
package-lock.json
node_modules
__tests__/runner/*
11 changes: 11 additions & 0 deletions fastlane-env-reminder/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
7 changes: 7 additions & 0 deletions fastlane-env-reminder/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:slim

COPY . .

RUN npm install --production

ENTRYPOINT ["node", "/lib/main.js"]
48 changes: 30 additions & 18 deletions fastlane-env-reminder/__tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
const path = require('path');
const nock = require('nock');

const validScenarios = [{
response: 'issue.json'
}
const validScenarios = [
{
response: 'issue.json'
}
];

const invalidScenarios = [{
response: 'pull-request.json',
}, {
response: 'action-closed.json',
}, {
response: 'issue-missing-body.json',
}, {
response: 'issue-contains-fastlane-env.json',
}, {
response: 'issue-feature-request.json'
}
const invalidScenarios = [
{
response: 'pull-request.json'
},
{
response: 'action-closed.json'
},
{
response: 'issue-missing-body.json'
},
{
response: 'issue-contains-fastlane-env.json'
},
{
response: 'issue-feature-request.json'
}
];

describe('action test suite', () => {
Expand All @@ -28,11 +34,14 @@ describe('action test suite', () => {
process.env['INPUT_REPO-TOKEN'] = repoToken;

process.env['GITHUB_REPOSITORY'] = 'foo/bar';
process.env['GITHUB_EVENT_PATH'] = path.join(__dirname, scenario.response);
process.env['GITHUB_EVENT_PATH'] = path.join(
__dirname,
scenario.response
);

const api = nock('https://api.github.com')
.persist()
.post('/repos/foo/bar/issues/10/comments', '{\"body\":\"message\"}')
.post('/repos/foo/bar/issues/10/comments', '{"body":"message"}')
.reply(200);

const main = require('../src/main');
Expand All @@ -50,11 +59,14 @@ describe('action test suite', () => {
process.env['INPUT_REPO-TOKEN'] = repoToken;

process.env['GITHUB_REPOSITORY'] = 'foo/bar';
process.env['GITHUB_EVENT_PATH'] = path.join(__dirname, scenario.response);
process.env['GITHUB_EVENT_PATH'] = path.join(
__dirname,
scenario.response
);

const api = nock('https://api.github.com')
.persist()
.post('/repos/foo/bar/issues/10/comments', '{\"body\":\"message\"}')
.post('/repos/foo/bar/issues/10/comments', '{"body":"message"}')
.reply(200);

const main = require('../src/main');
Expand Down
4 changes: 2 additions & 2 deletions fastlane-env-reminder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ inputs:
default: "It seems like you have not included the output of `fastlane env`\n
To make it easier for us help you resolve this issue, please update the issue to include the output of `fastlane env` :+1:"
runs:
using: 'node12'
main: 'lib/main.js'
using: 'docker'
image: 'Dockerfile'
29 changes: 0 additions & 29 deletions fastlane-env-reminder/docs/contributors.md

This file was deleted.

3 changes: 2 additions & 1 deletion fastlane-env-reminder/lib/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Expand Down
Loading

0 comments on commit dd8bb80

Please sign in to comment.