-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
20 changed files
with
193 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# ignore all files by default | ||
* | ||
# include required files with an exception | ||
!entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
FROM node:10 | ||
FROM node:10-slim | ||
|
||
ENV PATH=$PATH:/app/node_modules/.bin | ||
WORKDIR /app | ||
COPY . . | ||
RUN yarn | ||
RUN yarn build | ||
LABEL version="1.0.1" | ||
LABEL repository="http://github.com/kamilkisiela/graphql-inspector" | ||
LABEL homepage="http://github.com/kamilkisiela/graphql-inspector" | ||
LABEL maintainer="Kamil Kisiela <[email protected]>" | ||
|
||
ENTRYPOINT ["probot", "receive"] | ||
CMD ["/app/index.js"] | ||
LABEL com.github.actions.name="GitHub Action for GraphQL Inspector" | ||
LABEL com.github.actions.description="Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types." | ||
LABEL com.github.actions.icon="notify" | ||
LABEL com.github.actions.color="red" | ||
|
||
ENV LOG_LEVEL 'debug' | ||
|
||
RUN yarn global add @graphql-inspector/[email protected] | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
sh -c "graphql-inspector-github" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"version": "0.6.5" | ||
"version": "0.7.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/ | ||
tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
save-exact=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Kamil Kisiela | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "@graphql-inspector/actions", | ||
"version": "0.7.0", | ||
"description": "Github Actions for GraphQL", | ||
"sideEffects": false, | ||
"author": { | ||
"name": "Kamil Kisiela", | ||
"email": "[email protected]", | ||
"url": "https://github.com/kamilkisiela" | ||
}, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "kamilkisiela/graphql-inspector" | ||
}, | ||
"bin": { | ||
"graphql-inspector-github": "./dist/index.js" | ||
}, | ||
"keywords": [ | ||
"graphql", | ||
"graphql-inspector", | ||
"tools", | ||
"probot", | ||
"probot-plugin", | ||
"github" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"clean": "rm -rf dist/", | ||
"deploy": "now --docker", | ||
"prebuild": "yarn clean", | ||
"prepublishOnly": "yarn build" | ||
}, | ||
"dependencies": { | ||
"@graphql-inspector/github": "0.7.0", | ||
"graphql": "14.0.2", | ||
"probot": "7.4.0", | ||
"uuid": "3.3.2" | ||
}, | ||
"devDependencies": { | ||
"@types/graphql": "14.0.4", | ||
"@types/node": "10.12.18", | ||
"@types/uuid": "3.4.4", | ||
"typescript": "3.2.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
|
||
import appFn, {handleAction} from '@graphql-inspector/github'; | ||
import * as uuid from 'uuid'; | ||
import {resolve} from 'path'; | ||
import {findPrivateKey} from 'probot/lib/private-key'; | ||
import {createProbot, Application, ApplicationFunction} from 'probot'; | ||
|
||
const event = process.env.GITHUB_EVENT_NAME; | ||
const cert = findPrivateKey()!; | ||
const payload = require(resolve(process.env.GITHUB_EVENT_PATH!)); | ||
|
||
const probot = createProbot({ | ||
id: parseInt(process.env.APP_ID!, 10), | ||
cert: cert as string, | ||
githubToken: process.env.GITHUB_TOKEN, | ||
}); | ||
|
||
function wrapAppFn(fn: ApplicationFunction) { | ||
return (app: Application) => { | ||
fn(app); | ||
|
||
app.on('pull_request', async context => { | ||
if (!process.env.GITHUB_ACTION) { | ||
return; | ||
} | ||
const ref = context.payload.pull_request.head.sha; | ||
const action = 'gh-action'; | ||
const {owner, repo} = context.repo(); | ||
|
||
await handleAction({context, owner, repo, ref, action}); | ||
process.exit(0); | ||
}); | ||
|
||
app.on('push', async context => { | ||
if (!process.env.GITHUB_ACTION) { | ||
return; | ||
} | ||
|
||
const ref = context.payload.head_commit.id; | ||
const action = 'gh-action'; | ||
const {owner, repo} = context.repo(); | ||
|
||
await handleAction({context, owner, repo, ref, action}); | ||
process.exit(0); | ||
}); | ||
}; | ||
} | ||
|
||
probot.setup([wrapAppFn(appFn)]); | ||
|
||
probot.receive({name: event, payload, id: uuid.v4()}).catch(() => { | ||
// Process must exist non-zero to indicate that the action failed to run | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
|
||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"skipLibCheck": true, | ||
|
||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"baseUrl": "./", | ||
"types": [], | ||
"lib": ["es2015", "esnext.asynciterable"] | ||
}, | ||
"files": ["src/index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import appFn from './probot'; | ||
import appFn, {handleAction} from './probot'; | ||
|
||
export default appFn; | ||
export {handleAction}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters