diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 9e5dfd7..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @hiimbex @bkeepers diff --git a/basic-js/.DS_Store b/basic-js/.DS_Store new file mode 100644 index 0000000..1e46bde Binary files /dev/null and b/basic-js/.DS_Store differ diff --git a/.env.example b/basic-js/.env.example similarity index 100% rename from .env.example rename to basic-js/.env.example diff --git a/.gitignore b/basic-js/.gitignore similarity index 100% rename from .gitignore rename to basic-js/.gitignore diff --git a/CODE_OF_CONDUCT.md b/basic-js/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to basic-js/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/basic-js/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to basic-js/CONTRIBUTING.md diff --git a/LICENSE b/basic-js/LICENSE similarity index 100% rename from LICENSE rename to basic-js/LICENSE diff --git a/README.md b/basic-js/README.md similarity index 100% rename from README.md rename to basic-js/README.md diff --git a/index.js b/basic-js/index.js similarity index 100% rename from index.js rename to basic-js/index.js diff --git a/package.json b/basic-js/package.json similarity index 100% rename from package.json rename to basic-js/package.json diff --git a/test/fixtures/issues.opened.json b/basic-js/test/fixtures/issues.opened.json similarity index 100% rename from test/fixtures/issues.opened.json rename to basic-js/test/fixtures/issues.opened.json diff --git a/test/index.test.js b/basic-js/test/index.test.js similarity index 100% rename from test/index.test.js rename to basic-js/test/index.test.js diff --git a/.travis.yml b/basic-js/travis.yml similarity index 100% rename from .travis.yml rename to basic-js/travis.yml diff --git a/basic-ts/.env.example b/basic-ts/.env.example new file mode 100755 index 0000000..6e106aa --- /dev/null +++ b/basic-ts/.env.example @@ -0,0 +1,9 @@ +# The ID of your GitHub App +APP_ID= +WEBHOOK_SECRET=development + +# Use `trace` to get verbose logging or `info` to show less +LOG_LEVEL=debug + +# Go to https://smee.io/new set this to the URL that you are redirected to. +WEBHOOK_PROXY_URL= diff --git a/basic-ts/.github/CODEOWNERS b/basic-ts/.github/CODEOWNERS new file mode 100755 index 0000000..06bbf19 --- /dev/null +++ b/basic-ts/.github/CODEOWNERS @@ -0,0 +1 @@ +* @tcbyrd diff --git a/basic-ts/.gitignore b/basic-ts/.gitignore new file mode 100755 index 0000000..7b66818 --- /dev/null +++ b/basic-ts/.gitignore @@ -0,0 +1,7 @@ +node_modules +npm-debug.log +*.pem +.env +package-lock.json +coverage +lib \ No newline at end of file diff --git a/basic-ts/.travis.yml b/basic-ts/.travis.yml new file mode 100755 index 0000000..71156fd --- /dev/null +++ b/basic-ts/.travis.yml @@ -0,0 +1,6 @@ +sudo: false +language: node_js +node_js: + - "8.3" +notifications: + disabled: true diff --git a/basic-ts/CODE_OF_CONDUCT.md b/basic-ts/CODE_OF_CONDUCT.md new file mode 100755 index 0000000..6927b45 --- /dev/null +++ b/basic-ts/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{{ email }}}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + diff --git a/basic-ts/CONTRIBUTING.md b/basic-ts/CONTRIBUTING.md new file mode 100755 index 0000000..8f36999 --- /dev/null +++ b/basic-ts/CONTRIBUTING.md @@ -0,0 +1,41 @@ +## Contributing + +[fork]: /fork +[pr]: /compare +[style]: https://standardjs.com/ +[code-of-conduct]: CODE_OF_CONDUCT.md + +Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. + +Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. + +## Issues and PRs + +If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them. + +We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR. + +## Submitting a pull request + +1. [Fork][fork] and clone the repository. +1. Configure and install the dependencies: `npm install`. +1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so there's no need to lint separately. +1. Create a new branch: `git checkout -b my-branch-name`. +1. Make your change, add tests, and make sure the tests still pass. +1. Push to your fork and [submit a pull request][pr]. +1. Pat your self on the back and wait for your pull request to be reviewed and merged. + +Here are a few things you can do that will increase the likelihood of your pull request being accepted: + +- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test`. +- Write and update tests. +- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). + +Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you. + +## Resources + +- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) +- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) +- [GitHub Help](https://help.github.com) diff --git a/basic-ts/LICENSE b/basic-ts/LICENSE new file mode 100755 index 0000000..99506b4 --- /dev/null +++ b/basic-ts/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) {{{ year }}}, {{{ author }}} + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/basic-ts/README.md b/basic-ts/README.md new file mode 100755 index 0000000..593ce0a --- /dev/null +++ b/basic-ts/README.md @@ -0,0 +1,26 @@ +# {{ name }} + +> A GitHub App built with [Probot](https://github.com/probot/probot) that {{ description }} + +## Setup + +```sh +# Install dependencies +npm install + +# Run typescript +npm run build + +# Run the bot +npm start +``` + +## Contributing + +If you have suggestions for how {{ name }} could be improved, or want to report a bug, open an issue! We'd love all and any contributions. + +For more, check out the [Contributing Guide](CONTRIBUTING.md). + +## License + +[ISC](LICENSE) © {{{ year }}} {{{ author }}} diff --git a/basic-ts/jest.config.js b/basic-ts/jest.config.js new file mode 100755 index 0000000..8dfffb2 --- /dev/null +++ b/basic-ts/jest.config.js @@ -0,0 +1,8 @@ +module.exports = { + roots: ['/src/', '/test/'], + transform: { + '^.+\\.tsx?$': 'ts-jest' + }, + testRegex: '(/__tests__/.*|\\.(test|spec))\\.[tj]sx?$', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'] +} \ No newline at end of file diff --git a/basic-ts/package.json b/basic-ts/package.json new file mode 100755 index 0000000..de560bb --- /dev/null +++ b/basic-ts/package.json @@ -0,0 +1,50 @@ +{ + "name": "{{ name }}", + "version": "1.0.0", + "description": "{{{ description }}}", + "author": "{{{ author }}}", + "license": "ISC", + "repository": "https://github.com/{{ owner }}/{{ repo }}.git", + "homepage": "https://github.com/{{ owner }}/{{ repo }}", + "bugs": "https://github.com/{{ owner }}/{{ repo }}/issues", + "keywords": [ + "probot", + "github", + "probot-app" + ], + "scripts": { + "build": "tsc -p tsconfig.json", + "dev": "nodemon --exec \"npm start\"", + "start": "probot run ./lib/index.js", + "lint": "standard **/*.ts --fix", + "test": "jest && standard **/*.ts", + "test:watch": "jest --watch --notify --notifyMode=change --coverage" + }, + "dependencies": { + "probot": "^7.0.0" + }, + "devDependencies": { + "@types/jest": "^23.1.5", + "@types/node": "^10.5.2", + "eslint-plugin-typescript": "^0.12.0", + "jest": "^23.4.0", + "nodemon": "^1.17.2", + "smee-client": "^1.0.2", + "standard": "^10.0.3", + "ts-jest": "^23.0.0", + "typescript": "^2.9.2", + "typescript-eslint-parser": "^18.0.0" + }, + "engines": { + "node": ">= 8.3.0" + }, + "standard": { + "parser": "typescript-eslint-parser", + "env": [ + "jest" + ], + "plugins": [ + "typescript" + ] + } +} diff --git a/basic-ts/src/index.ts b/basic-ts/src/index.ts new file mode 100755 index 0000000..2137b0e --- /dev/null +++ b/basic-ts/src/index.ts @@ -0,0 +1,12 @@ +import { Application } from 'probot' + +export = (app: Application) => { + // Your code here + app.log('Yay, the app was loaded!') + + // For more information on building apps: + // https://probot.github.io/docs/ + + // To get your app running against GitHub, see: + // https://probot.github.io/docs/development/ +} diff --git a/basic-ts/test/index.test.ts b/basic-ts/test/index.test.ts new file mode 100755 index 0000000..c800167 --- /dev/null +++ b/basic-ts/test/index.test.ts @@ -0,0 +1,10 @@ +// You can import your modules +// import index from '../src/index' + +test('that we can run tests', () => { + // your real tests go here + expect(1 + 2 + 3).toBe(6) +}) + +// For more information about using TypeScript in your tests, Jest recommends: +// https://github.com/kulshekhar/ts-jest diff --git a/basic-ts/tsconfig.json b/basic-ts/tsconfig.json new file mode 100755 index 0000000..e4c4618 --- /dev/null +++ b/basic-ts/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "allowJs": false, + "lib": ["es2015", "es2017"], + "module": "commonjs", + "moduleResolution": "node", + "target": "es5", + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "pretty": true, + "strict": true, + "sourceMap": true, + "outDir": "./lib", + "skipLibCheck": true, + "noImplicitAny": true, + "esModuleInterop": true, + "declaration": true + }, + "include": [ + "src/**/*" + ], + "compileOnSave": false +} diff --git a/checks-js/.DS_Store b/checks-js/.DS_Store new file mode 100644 index 0000000..1e46bde Binary files /dev/null and b/checks-js/.DS_Store differ diff --git a/checks-js/.env.example b/checks-js/.env.example new file mode 100644 index 0000000..6e106aa --- /dev/null +++ b/checks-js/.env.example @@ -0,0 +1,9 @@ +# The ID of your GitHub App +APP_ID= +WEBHOOK_SECRET=development + +# Use `trace` to get verbose logging or `info` to show less +LOG_LEVEL=debug + +# Go to https://smee.io/new set this to the URL that you are redirected to. +WEBHOOK_PROXY_URL= diff --git a/checks-js/.gitignore b/checks-js/.gitignore new file mode 100644 index 0000000..eafcb22 --- /dev/null +++ b/checks-js/.gitignore @@ -0,0 +1,6 @@ +node_modules +npm-debug.log +*.pem +.env +package-lock.json +coverage diff --git a/checks-js/.travis.yml b/checks-js/.travis.yml new file mode 100644 index 0000000..71156fd --- /dev/null +++ b/checks-js/.travis.yml @@ -0,0 +1,6 @@ +sudo: false +language: node_js +node_js: + - "8.3" +notifications: + disabled: true diff --git a/checks-js/CODE_OF_CONDUCT.md b/checks-js/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..6927b45 --- /dev/null +++ b/checks-js/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{{ email }}}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + diff --git a/checks-js/CONTRIBUTING.md b/checks-js/CONTRIBUTING.md new file mode 100644 index 0000000..8f36999 --- /dev/null +++ b/checks-js/CONTRIBUTING.md @@ -0,0 +1,41 @@ +## Contributing + +[fork]: /fork +[pr]: /compare +[style]: https://standardjs.com/ +[code-of-conduct]: CODE_OF_CONDUCT.md + +Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. + +Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. + +## Issues and PRs + +If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them. + +We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR. + +## Submitting a pull request + +1. [Fork][fork] and clone the repository. +1. Configure and install the dependencies: `npm install`. +1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so there's no need to lint separately. +1. Create a new branch: `git checkout -b my-branch-name`. +1. Make your change, add tests, and make sure the tests still pass. +1. Push to your fork and [submit a pull request][pr]. +1. Pat your self on the back and wait for your pull request to be reviewed and merged. + +Here are a few things you can do that will increase the likelihood of your pull request being accepted: + +- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test`. +- Write and update tests. +- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). + +Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you. + +## Resources + +- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) +- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) +- [GitHub Help](https://help.github.com) diff --git a/checks-js/LICENSE b/checks-js/LICENSE new file mode 100644 index 0000000..99506b4 --- /dev/null +++ b/checks-js/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) {{{ year }}}, {{{ author }}} + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/checks-js/README.md b/checks-js/README.md new file mode 100644 index 0000000..80d66a1 --- /dev/null +++ b/checks-js/README.md @@ -0,0 +1,23 @@ +# {{ name }} + +> A GitHub App built with [Probot](https://github.com/probot/probot) that {{ description }} + +## Setup + +```sh +# Install dependencies +npm install + +# Run the bot +npm start +``` + +## Contributing + +If you have suggestions for how {{ name }} could be improved, or want to report a bug, open an issue! We'd love all and any contributions. + +For more, check out the [Contributing Guide](CONTRIBUTING.md). + +## License + +[ISC](LICENSE) © {{{ year }}} {{{ author }}} diff --git a/checks-js/index.js b/checks-js/index.js new file mode 100644 index 0000000..84daa2e --- /dev/null +++ b/checks-js/index.js @@ -0,0 +1,34 @@ +/** + * This is the entry point for your Probot App. + * @param {import('probot').Application} app - Probot's Application class. +*/ + +// Checks API example +// See: https://developer.github.com/v3/checks/ to learn more +module.exports = app => { + app.on(['check_suite.requested', 'check_run.rerequested'], check) + + async function check (context) { + // Do stuff + // Probot API note: context.repo() => {username: 'hiimbex', repo: 'testing-things'} + return context.github.checks.create(context.repo({ + name: 'My app!', + head_branch: pr.head.ref, + head_sha: pr.head.sha, + status: 'completed', + conclusion: 'success', + completed_at: new Date(), + output: { + title: 'My Check', + summary: 'The check has passed!' + } + })) + } +} + + // For more information on building apps: + // https://probot.github.io/docs/ + + // To get your app running against GitHub, see: + // https://probot.github.io/docs/development/ +} diff --git a/checks-js/package.json b/checks-js/package.json new file mode 100644 index 0000000..1d7d8e3 --- /dev/null +++ b/checks-js/package.json @@ -0,0 +1,43 @@ +{ + "name": "{{ name }}", + "version": "1.0.0", + "description": "{{{ description }}}", + "author": "{{{ author }}}", + "license": "ISC", + "repository": "https://github.com/{{ owner }}/{{ repo }}.git", + "homepage": "https://github.com/{{ owner }}/{{ repo }}", + "bugs": "https://github.com/{{ owner }}/{{ repo }}/issues", + "keywords": [ + "probot", + "github", + "probot-app" + ], + "scripts": { + "dev": "nodemon", + "start": "probot run ./index.js", + "lint": "standard --fix", + "test": "jest && standard", + "test:watch": "jest --watch --notify --notifyMode=change --coverage" + }, + "dependencies": { + "probot": "^7.0.0" + }, + "devDependencies": { + "jest": "^22.4.3", + "nodemon": "^1.17.2", + "smee-client": "^1.0.2", + "standard": "^10.0.3" + }, + "engines": { + "node": ">= 8.3.0" + }, + "standard": { + "env": [ + "jest" + ] + }, + "nodemonConfig": { + "exec": "npm start", + "watch": [".env", "."] + } +} diff --git a/checks-js/test/fixtures/issues.opened.json b/checks-js/test/fixtures/issues.opened.json new file mode 100644 index 0000000..84ebf04 --- /dev/null +++ b/checks-js/test/fixtures/issues.opened.json @@ -0,0 +1,159 @@ +{ + "action": "opened", + "issue": { + "url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2", + "repository_url": "https://api.github.com/repos/Codertocat/Hello-World", + "labels_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2/labels{/name}", + "comments_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2/comments", + "events_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2/events", + "html_url": "https://github.com/Codertocat/Hello-World/issues/2", + "id": 327883527, + "node_id": "MDU6SXNzdWUzMjc4ODM1Mjc=", + "number": 2, + "title": "Spelling error in the README file", + "user": { + "login": "Codertocat", + "id": 21031067, + "node_id": "MDQ6VXNlcjIxMDMxMDY3", + "avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Codertocat", + "html_url": "https://github.com/Codertocat", + "followers_url": "https://api.github.com/users/Codertocat/followers", + "following_url": "https://api.github.com/users/Codertocat/following{/other_user}", + "gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions", + "organizations_url": "https://api.github.com/users/Codertocat/orgs", + "repos_url": "https://api.github.com/users/Codertocat/repos", + "events_url": "https://api.github.com/users/Codertocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/Codertocat/received_events", + "type": "User", + "site_admin": false + }, + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 0, + "created_at": "2018-05-30T20:18:32Z", + "updated_at": "2018-05-30T20:18:32Z", + "closed_at": null, + "author_association": "OWNER", + "body": "It looks like you accidently spelled 'commit' with two 't's." + }, + "repository": { + "id": 135493233, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzU0OTMyMzM=", + "name": "Hello-World", + "full_name": "Codertocat/Hello-World", + "owner": { + "login": "Codertocat", + "id": 21031067, + "node_id": "MDQ6VXNlcjIxMDMxMDY3", + "avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Codertocat", + "html_url": "https://github.com/Codertocat", + "followers_url": "https://api.github.com/users/Codertocat/followers", + "following_url": "https://api.github.com/users/Codertocat/following{/other_user}", + "gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions", + "organizations_url": "https://api.github.com/users/Codertocat/orgs", + "repos_url": "https://api.github.com/users/Codertocat/repos", + "events_url": "https://api.github.com/users/Codertocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/Codertocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/Codertocat/Hello-World", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/Codertocat/Hello-World", + "forks_url": "https://api.github.com/repos/Codertocat/Hello-World/forks", + "keys_url": "https://api.github.com/repos/Codertocat/Hello-World/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Codertocat/Hello-World/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Codertocat/Hello-World/teams", + "hooks_url": "https://api.github.com/repos/Codertocat/Hello-World/hooks", + "issue_events_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/events{/number}", + "events_url": "https://api.github.com/repos/Codertocat/Hello-World/events", + "assignees_url": "https://api.github.com/repos/Codertocat/Hello-World/assignees{/user}", + "branches_url": "https://api.github.com/repos/Codertocat/Hello-World/branches{/branch}", + "tags_url": "https://api.github.com/repos/Codertocat/Hello-World/tags", + "blobs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Codertocat/Hello-World/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Codertocat/Hello-World/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Codertocat/Hello-World/languages", + "stargazers_url": "https://api.github.com/repos/Codertocat/Hello-World/stargazers", + "contributors_url": "https://api.github.com/repos/Codertocat/Hello-World/contributors", + "subscribers_url": "https://api.github.com/repos/Codertocat/Hello-World/subscribers", + "subscription_url": "https://api.github.com/repos/Codertocat/Hello-World/subscription", + "commits_url": "https://api.github.com/repos/Codertocat/Hello-World/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Codertocat/Hello-World/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Codertocat/Hello-World/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Codertocat/Hello-World/contents/{+path}", + "compare_url": "https://api.github.com/repos/Codertocat/Hello-World/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Codertocat/Hello-World/merges", + "archive_url": "https://api.github.com/repos/Codertocat/Hello-World/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Codertocat/Hello-World/downloads", + "issues_url": "https://api.github.com/repos/Codertocat/Hello-World/issues{/number}", + "pulls_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Codertocat/Hello-World/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Codertocat/Hello-World/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Codertocat/Hello-World/labels{/name}", + "releases_url": "https://api.github.com/repos/Codertocat/Hello-World/releases{/id}", + "deployments_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments", + "created_at": "2018-05-30T20:18:04Z", + "updated_at": "2018-05-30T20:18:10Z", + "pushed_at": "2018-05-30T20:18:30Z", + "git_url": "git://github.com/Codertocat/Hello-World.git", + "ssh_url": "git@github.com:Codertocat/Hello-World.git", + "clone_url": "https://github.com/Codertocat/Hello-World.git", + "svn_url": "https://github.com/Codertocat/Hello-World", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 2, + "license": null, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "Codertocat", + "id": 21031067, + "node_id": "MDQ6VXNlcjIxMDMxMDY3", + "avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Codertocat", + "html_url": "https://github.com/Codertocat", + "followers_url": "https://api.github.com/users/Codertocat/followers", + "following_url": "https://api.github.com/users/Codertocat/following{/other_user}", + "gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions", + "organizations_url": "https://api.github.com/users/Codertocat/orgs", + "repos_url": "https://api.github.com/users/Codertocat/repos", + "events_url": "https://api.github.com/users/Codertocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/Codertocat/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/checks-js/test/index.test.js b/checks-js/test/index.test.js new file mode 100644 index 0000000..674c7f7 --- /dev/null +++ b/checks-js/test/index.test.js @@ -0,0 +1,42 @@ +const { Application } = require('probot') +// Requiring our app implementation +const myProbotApp = require('..') + +const issuesOpenedPayload = require('./fixtures/issues.opened.json') + +test('that we can run tests', () => { + // your real tests go here + expect(1 + 2 + 3).toBe(6) +}) + +describe('My Probot app', () => { + let app, github + + beforeEach(() => { + app = new Application() + // Initialize the app based on the code from index.js + app.load(myProbotApp) + // This is an easy way to mock out the GitHub API + github = { + issues: { + createComment: jest.fn().mockReturnValue(Promise.resolve({})) + } + } + // Passes the mocked out GitHub API into out app instance + app.auth = () => Promise.resolve(github) + }) + + test('creates a comment when an issue is opened', async () => { + // Simulates delivery of an issues.opened webhook + await app.receive({ + event: 'issues.opened', + payload: issuesOpenedPayload + }) + + // This test passes if the code in your index.js file calls `context.github.issues.createComment` + expect(github.issues.createComment).toHaveBeenCalled() + }) +}) + +// For more information about testing with Jest see: +// https://facebook.github.io/jest/ diff --git a/git-data-js/.DS_Store b/git-data-js/.DS_Store new file mode 100644 index 0000000..1e46bde Binary files /dev/null and b/git-data-js/.DS_Store differ diff --git a/git-data-js/.env.example b/git-data-js/.env.example new file mode 100644 index 0000000..6e106aa --- /dev/null +++ b/git-data-js/.env.example @@ -0,0 +1,9 @@ +# The ID of your GitHub App +APP_ID= +WEBHOOK_SECRET=development + +# Use `trace` to get verbose logging or `info` to show less +LOG_LEVEL=debug + +# Go to https://smee.io/new set this to the URL that you are redirected to. +WEBHOOK_PROXY_URL= diff --git a/git-data-js/.gitignore b/git-data-js/.gitignore new file mode 100644 index 0000000..eafcb22 --- /dev/null +++ b/git-data-js/.gitignore @@ -0,0 +1,6 @@ +node_modules +npm-debug.log +*.pem +.env +package-lock.json +coverage diff --git a/git-data-js/.travis.yml b/git-data-js/.travis.yml new file mode 100644 index 0000000..71156fd --- /dev/null +++ b/git-data-js/.travis.yml @@ -0,0 +1,6 @@ +sudo: false +language: node_js +node_js: + - "8.3" +notifications: + disabled: true diff --git a/git-data-js/CODE_OF_CONDUCT.md b/git-data-js/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..6927b45 --- /dev/null +++ b/git-data-js/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{{ email }}}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + diff --git a/git-data-js/CONTRIBUTING.md b/git-data-js/CONTRIBUTING.md new file mode 100644 index 0000000..8f36999 --- /dev/null +++ b/git-data-js/CONTRIBUTING.md @@ -0,0 +1,41 @@ +## Contributing + +[fork]: /fork +[pr]: /compare +[style]: https://standardjs.com/ +[code-of-conduct]: CODE_OF_CONDUCT.md + +Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. + +Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. + +## Issues and PRs + +If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them. + +We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR. + +## Submitting a pull request + +1. [Fork][fork] and clone the repository. +1. Configure and install the dependencies: `npm install`. +1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so there's no need to lint separately. +1. Create a new branch: `git checkout -b my-branch-name`. +1. Make your change, add tests, and make sure the tests still pass. +1. Push to your fork and [submit a pull request][pr]. +1. Pat your self on the back and wait for your pull request to be reviewed and merged. + +Here are a few things you can do that will increase the likelihood of your pull request being accepted: + +- Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test`. +- Write and update tests. +- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). + +Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you. + +## Resources + +- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) +- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) +- [GitHub Help](https://help.github.com) diff --git a/git-data-js/LICENSE b/git-data-js/LICENSE new file mode 100644 index 0000000..99506b4 --- /dev/null +++ b/git-data-js/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) {{{ year }}}, {{{ author }}} + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/git-data-js/README.md b/git-data-js/README.md new file mode 100644 index 0000000..80d66a1 --- /dev/null +++ b/git-data-js/README.md @@ -0,0 +1,23 @@ +# {{ name }} + +> A GitHub App built with [Probot](https://github.com/probot/probot) that {{ description }} + +## Setup + +```sh +# Install dependencies +npm install + +# Run the bot +npm start +``` + +## Contributing + +If you have suggestions for how {{ name }} could be improved, or want to report a bug, open an issue! We'd love all and any contributions. + +For more, check out the [Contributing Guide](CONTRIBUTING.md). + +## License + +[ISC](LICENSE) © {{{ year }}} {{{ author }}} diff --git a/git-data-js/index.js b/git-data-js/index.js new file mode 100644 index 0000000..932577c --- /dev/null +++ b/git-data-js/index.js @@ -0,0 +1,42 @@ +/** + * This is the entry point for your Probot App. + * @param {import('probot').Application} app - Probot's Application class. +*/ + +// Git Data API example +// See: https://developer.github.com/v3/git/ to learn more +module.exports = app => { + app.on('*', check) + + async function check (context) { + // Probot API note: context.repo() => {username: 'hiimbex', repo: 'testing-things'} + // Get current reference in Git + const reference = await context.github.gitdata.getReference(context.repo({ ref: 'heads/master' })) + // Create a brnach + const getBranch = await context.github.gitdata.createReference(context.repo({ + ref: `refs/heads/new-branch`, + sha: reference.data.object.sha // accesses the sha from the heads/master reference we got + })) + // create a cne wfile + const file = await context.github.repos.createFile(context.repo({ + path: 'path/to/your/file.md', // the path to your config file + message: 'adds config file', // a commit message + content: 'My new file is awesome!', //the content of your file + branch: 'new-branch' // the branch name we used when creating a Git reference + })) + return await context.github.pullRequests.create(context.repo({ + title: 'Adding my file!', // the title of the PR + head: 'new-branch', // the branch our chances are on + base: 'master', // the branch to which you want to merge your changes + body: 'Adds my new file!', // the body of your PR, + maintainer_can_modify: true // allows maintainers to edit your app's PR + })) + } +} + + // For more information on building apps: + // https://probot.github.io/docs/ + + // To get your app running against GitHub, see: + // https://probot.github.io/docs/development/ +} diff --git a/git-data-js/package.json b/git-data-js/package.json new file mode 100644 index 0000000..1d7d8e3 --- /dev/null +++ b/git-data-js/package.json @@ -0,0 +1,43 @@ +{ + "name": "{{ name }}", + "version": "1.0.0", + "description": "{{{ description }}}", + "author": "{{{ author }}}", + "license": "ISC", + "repository": "https://github.com/{{ owner }}/{{ repo }}.git", + "homepage": "https://github.com/{{ owner }}/{{ repo }}", + "bugs": "https://github.com/{{ owner }}/{{ repo }}/issues", + "keywords": [ + "probot", + "github", + "probot-app" + ], + "scripts": { + "dev": "nodemon", + "start": "probot run ./index.js", + "lint": "standard --fix", + "test": "jest && standard", + "test:watch": "jest --watch --notify --notifyMode=change --coverage" + }, + "dependencies": { + "probot": "^7.0.0" + }, + "devDependencies": { + "jest": "^22.4.3", + "nodemon": "^1.17.2", + "smee-client": "^1.0.2", + "standard": "^10.0.3" + }, + "engines": { + "node": ">= 8.3.0" + }, + "standard": { + "env": [ + "jest" + ] + }, + "nodemonConfig": { + "exec": "npm start", + "watch": [".env", "."] + } +} diff --git a/git-data-js/test/fixtures/issues.opened.json b/git-data-js/test/fixtures/issues.opened.json new file mode 100644 index 0000000..84ebf04 --- /dev/null +++ b/git-data-js/test/fixtures/issues.opened.json @@ -0,0 +1,159 @@ +{ + "action": "opened", + "issue": { + "url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2", + "repository_url": "https://api.github.com/repos/Codertocat/Hello-World", + "labels_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2/labels{/name}", + "comments_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2/comments", + "events_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/2/events", + "html_url": "https://github.com/Codertocat/Hello-World/issues/2", + "id": 327883527, + "node_id": "MDU6SXNzdWUzMjc4ODM1Mjc=", + "number": 2, + "title": "Spelling error in the README file", + "user": { + "login": "Codertocat", + "id": 21031067, + "node_id": "MDQ6VXNlcjIxMDMxMDY3", + "avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Codertocat", + "html_url": "https://github.com/Codertocat", + "followers_url": "https://api.github.com/users/Codertocat/followers", + "following_url": "https://api.github.com/users/Codertocat/following{/other_user}", + "gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions", + "organizations_url": "https://api.github.com/users/Codertocat/orgs", + "repos_url": "https://api.github.com/users/Codertocat/repos", + "events_url": "https://api.github.com/users/Codertocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/Codertocat/received_events", + "type": "User", + "site_admin": false + }, + "state": "open", + "locked": false, + "assignee": null, + "assignees": [], + "milestone": null, + "comments": 0, + "created_at": "2018-05-30T20:18:32Z", + "updated_at": "2018-05-30T20:18:32Z", + "closed_at": null, + "author_association": "OWNER", + "body": "It looks like you accidently spelled 'commit' with two 't's." + }, + "repository": { + "id": 135493233, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzU0OTMyMzM=", + "name": "Hello-World", + "full_name": "Codertocat/Hello-World", + "owner": { + "login": "Codertocat", + "id": 21031067, + "node_id": "MDQ6VXNlcjIxMDMxMDY3", + "avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Codertocat", + "html_url": "https://github.com/Codertocat", + "followers_url": "https://api.github.com/users/Codertocat/followers", + "following_url": "https://api.github.com/users/Codertocat/following{/other_user}", + "gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions", + "organizations_url": "https://api.github.com/users/Codertocat/orgs", + "repos_url": "https://api.github.com/users/Codertocat/repos", + "events_url": "https://api.github.com/users/Codertocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/Codertocat/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/Codertocat/Hello-World", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/Codertocat/Hello-World", + "forks_url": "https://api.github.com/repos/Codertocat/Hello-World/forks", + "keys_url": "https://api.github.com/repos/Codertocat/Hello-World/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Codertocat/Hello-World/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Codertocat/Hello-World/teams", + "hooks_url": "https://api.github.com/repos/Codertocat/Hello-World/hooks", + "issue_events_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/events{/number}", + "events_url": "https://api.github.com/repos/Codertocat/Hello-World/events", + "assignees_url": "https://api.github.com/repos/Codertocat/Hello-World/assignees{/user}", + "branches_url": "https://api.github.com/repos/Codertocat/Hello-World/branches{/branch}", + "tags_url": "https://api.github.com/repos/Codertocat/Hello-World/tags", + "blobs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Codertocat/Hello-World/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Codertocat/Hello-World/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Codertocat/Hello-World/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Codertocat/Hello-World/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Codertocat/Hello-World/languages", + "stargazers_url": "https://api.github.com/repos/Codertocat/Hello-World/stargazers", + "contributors_url": "https://api.github.com/repos/Codertocat/Hello-World/contributors", + "subscribers_url": "https://api.github.com/repos/Codertocat/Hello-World/subscribers", + "subscription_url": "https://api.github.com/repos/Codertocat/Hello-World/subscription", + "commits_url": "https://api.github.com/repos/Codertocat/Hello-World/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Codertocat/Hello-World/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Codertocat/Hello-World/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Codertocat/Hello-World/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Codertocat/Hello-World/contents/{+path}", + "compare_url": "https://api.github.com/repos/Codertocat/Hello-World/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Codertocat/Hello-World/merges", + "archive_url": "https://api.github.com/repos/Codertocat/Hello-World/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Codertocat/Hello-World/downloads", + "issues_url": "https://api.github.com/repos/Codertocat/Hello-World/issues{/number}", + "pulls_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Codertocat/Hello-World/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Codertocat/Hello-World/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Codertocat/Hello-World/labels{/name}", + "releases_url": "https://api.github.com/repos/Codertocat/Hello-World/releases{/id}", + "deployments_url": "https://api.github.com/repos/Codertocat/Hello-World/deployments", + "created_at": "2018-05-30T20:18:04Z", + "updated_at": "2018-05-30T20:18:10Z", + "pushed_at": "2018-05-30T20:18:30Z", + "git_url": "git://github.com/Codertocat/Hello-World.git", + "ssh_url": "git@github.com:Codertocat/Hello-World.git", + "clone_url": "https://github.com/Codertocat/Hello-World.git", + "svn_url": "https://github.com/Codertocat/Hello-World", + "homepage": null, + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": true, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "open_issues_count": 2, + "license": null, + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "Codertocat", + "id": 21031067, + "node_id": "MDQ6VXNlcjIxMDMxMDY3", + "avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Codertocat", + "html_url": "https://github.com/Codertocat", + "followers_url": "https://api.github.com/users/Codertocat/followers", + "following_url": "https://api.github.com/users/Codertocat/following{/other_user}", + "gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions", + "organizations_url": "https://api.github.com/users/Codertocat/orgs", + "repos_url": "https://api.github.com/users/Codertocat/repos", + "events_url": "https://api.github.com/users/Codertocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/Codertocat/received_events", + "type": "User", + "site_admin": false + } +} \ No newline at end of file diff --git a/git-data-js/test/index.test.js b/git-data-js/test/index.test.js new file mode 100644 index 0000000..674c7f7 --- /dev/null +++ b/git-data-js/test/index.test.js @@ -0,0 +1,42 @@ +const { Application } = require('probot') +// Requiring our app implementation +const myProbotApp = require('..') + +const issuesOpenedPayload = require('./fixtures/issues.opened.json') + +test('that we can run tests', () => { + // your real tests go here + expect(1 + 2 + 3).toBe(6) +}) + +describe('My Probot app', () => { + let app, github + + beforeEach(() => { + app = new Application() + // Initialize the app based on the code from index.js + app.load(myProbotApp) + // This is an easy way to mock out the GitHub API + github = { + issues: { + createComment: jest.fn().mockReturnValue(Promise.resolve({})) + } + } + // Passes the mocked out GitHub API into out app instance + app.auth = () => Promise.resolve(github) + }) + + test('creates a comment when an issue is opened', async () => { + // Simulates delivery of an issues.opened webhook + await app.receive({ + event: 'issues.opened', + payload: issuesOpenedPayload + }) + + // This test passes if the code in your index.js file calls `context.github.issues.createComment` + expect(github.issues.createComment).toHaveBeenCalled() + }) +}) + +// For more information about testing with Jest see: +// https://facebook.github.io/jest/