├── .env.example ├── .eslintignore ├── .eslintrc.yml ├── .flowconfig ├── .github ├── ReplyRef.md └── duplicate.md ├── .gitignore ├── .prettierrc.yml ├── .travis.yml ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── __tests__ └── index.test.js ├── app.json ├── docs ├── deploy.md ├── logo.png └── logo.svg ├── flow-typed ├── npm │ ├── jest_v21.x.x.js │ ├── minimist_v1.x.x.js │ └── ramda_v0.x.x.js └── src │ └── index.flow.js ├── jobs └── deploy-heroku.sh ├── package.json ├── src ├── index.js ├── templates │ ├── dialog.md │ ├── duplicate.md │ ├── feature.md │ ├── issue.md │ └── pr.md ├── utils │ ├── __tests__ │ │ └── template.test.js │ ├── ghAPI.js │ ├── handlebars.js │ └── template.js └── webhookHandler.js └── yarn.lock /.env.example: -------------------------------------------------------------------------------- 1 | # The ID of your GitHub App 2 | APP_ID= 3 | WEBHOOK_SECRET=development 4 | # PRIVATE_KEY_PATH= 5 | 6 | # Uncomment this to get verbose logging 7 | # LOG_LEVEL=trace # or `info` to show less 8 | 9 | # Subdomain to use for localtunnel server. Defaults to your local username. 10 | # SUBDOMAIN= 11 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | /flow-typed 4 | -------------------------------------------------------------------------------- /.eslintrc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | root: true 3 | env: 4 | browser: true 5 | commonjs: true 6 | es6: true 7 | node: true 8 | globals: 9 | describe: true # jest 10 | test: true # jest 11 | expect: true # jest 12 | extends: 13 | - 'eslint:recommended' 14 | plugins: 15 | - prettier 16 | parserOptions: 17 | ecmaVersion: 8 18 | sourceType: module 19 | ecmaFeatures: 20 | experimentalObjectRestSpread: true 21 | rules: 22 | prettier/prettier: 23 | - off 24 | no-console: off 25 | no-unused-vars: 26 | - warn 27 | - vars: all 28 | args: after-used 29 | comma-dangle: 30 | - error 31 | - arrays: always-multiline 32 | objects: always-multiline 33 | functions: never 34 | indent: 35 | - error 36 | - 2 37 | linebreak-style: 38 | - error 39 | - unix 40 | quotes: 41 | - warn 42 | - single 43 | semi: 44 | - error 45 | - never 46 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | 11 | [strict] 12 | -------------------------------------------------------------------------------- /.github/ReplyRef.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | This is related to #{{ n }} 4 | -------------------------------------------------------------------------------- /.github/duplicate.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 😢 This is duplicate of #{{ num }}. 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | *.pem 4 | .env 5 | package-lock.json 6 | yarn.lock 7 | coverage 8 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | semi: false 2 | singleQuote: true 3 | trailingComma: es5 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: node_js 4 | 5 | node_js: 6 | - "10" 7 | 8 | branches: 9 | only: 10 | - master 11 | 12 | script: 13 | - yarn run lint 14 | - yarn run test 15 | 16 | notifications: 17 | email: 18 | recipients: 19 | - liuderchi@gmail.com 20 | on_success: never 21 | on_failure: change 22 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## CHANGELOG 2 | 3 | ### upcoming (2018/02/22 09:23 +00:00) 4 | - [#14](https://github.com/liuderchi/gh-template-bot/pull/14) chore(packageJson): yarn add request@latest (@liuderchi) 5 | - [0251fc1](https://github.com/liuderchi/gh-template-bot/commit/0251fc1d3daf0b404ebdffeb36c83a817f6064be) chore(packageJson): yarn add request@latest (@liuderchi) 6 | - [#13](https://github.com/liuderchi/gh-template-bot/pull/13) Update Changelog (@liuderchi) 7 | - [79bf37b](https://github.com/liuderchi/gh-template-bot/commit/79bf37b55ece72050719eee42def772e526c721e) docs(changelog): update changelog (@liuderchi) 8 | - [#12](https://github.com/liuderchi/gh-template-bot/pull/12) Introduce codecov (@liuderchi) 9 | - [61fc75f](https://github.com/liuderchi/gh-template-bot/commit/61fc75f29a3bd7e0e36bb4f8a37f63c895b8edb1) chore(codecov, packagejson): introduce codecov (@liuderchi) 10 | - [#11](https://github.com/liuderchi/gh-template-bot/pull/11) Introduce Flow and Flowtype (@liuderchi) 11 | - [954f860](https://github.com/liuderchi/gh-template-bot/commit/954f860cb5f044ec37398c1dc9707eabe0898632) chore(flow): add flow type for utils/template .js (@liuderchi) 12 | - [3eb9334](https://github.com/liuderchi/gh-template-bot/commit/3eb93342368d95acad10b5e5a1838803a6dcd680) chore(flowtyped): add flow type for npm dependencies (@liuderchi) 13 | - [ee88b48](https://github.com/liuderchi/gh-template-bot/commit/ee88b4816fdb711cf85912701b4b6879c85911c8) chore(flow): add flow type for webhookHandler.js (@liuderchi) 14 | - [2808942](https://github.com/liuderchi/gh-template-bot/commit/2808942a7fe2ab5af4f61469693b065dc3575354) chore(flow): add flow notation (@liuderchi) 15 | - [207a5c2](https://github.com/liuderchi/gh-template-bot/commit/207a5c21ddd7fb3f0af1db281beefbcd283851b0) chore(flow): move type def in flow-typed/index.flow.js (@liuderchi) 16 | - [5e1b846](https://github.com/liuderchi/gh-template-bot/commit/5e1b84639aa239aa129a1bc98b8b0dbc9f70881a) chore(packagejson, travis): add flow, lint scripts, update travis config (@liuderchi) 17 | - [a97e08b](https://github.com/liuderchi/gh-template-bot/commit/a97e08ba7f5cb2dd7b5001ba3d2509f02b8abc2e) chore(packagejson): install flow-bin and init flow project (@liuderchi) 18 | - [f77333f](https://github.com/liuderchi/gh-template-bot/commit/f77333fd09109139be02827a79f5172adae66773) docs(github): create duplicate.md for Demo (@liuderchi) 19 | - [a580b0c](https://github.com/liuderchi/gh-template-bot/commit/a580b0c2c838329f85e3bce4ac83bbd9932e2b93) doc(github): add ReplyRef.md for demo (@liuderchi) 20 | 21 | ### v0.2.0 (2017/11/22 18:18 +00:00) 22 | - [#9](https://github.com/liuderchi/gh-template-bot/pull/9) Custom Templates (@liuderchi) 23 | - [1cf1483](https://github.com/liuderchi/gh-template-bot/commit/1cf1483ba205c55dcd0daad26defc3bf5a76031f) doc(dialog, readme): update dialog.md, README.md for better illustration (@liuderchi) 24 | - [fbde97e](https://github.com/liuderchi/gh-template-bot/commit/fbde97e6f5d716f0395c3d3fc1affc3e1aeace76) feat(handler): add handleIssueCommentWH() (@liuderchi) 25 | - [23bc74d](https://github.com/liuderchi/gh-template-bot/commit/23bc74d99761b76390888e211ad9400708c2c388) feat(utils): validate command action before get markdown content (@liuderchi) 26 | - [200a309](https://github.com/liuderchi/gh-template-bot/commit/200a3098e82cc3d7ffc5af0e2b40e01274a018a3) feat(handler, utils, packagejson): Fetch Custom Template from `.github/` (@liuderchi) 27 | - [3e771b1](https://github.com/liuderchi/gh-template-bot/commit/3e771b160aa9b4ec3c54937943d541201876172f) chores(packagejson): install npm `handlebars`, `minimist` (@liuderchi) 28 | - [e8cfdf1](https://github.com/liuderchi/gh-template-bot/commit/e8cfdf19cfb3ae06ebe1bfb90ed6f730de84523d) feat(utils): support custom markdown template with handlebar syntax (@liuderchi) 29 | - [c67ea2a](https://github.com/liuderchi/gh-template-bot/commit/c67ea2a27ca4078eb31dc36e5e59c113fb484ce3) feat(utils): refine getCommmand() in template.js (@liuderchi) 30 | - [05ed9d2](https://github.com/liuderchi/gh-template-bot/commit/05ed9d2d7cf42e2f87d9c3820030d6b144160896) refactor(templates): templates/*.js -> templates/*.md (@liuderchi) 31 | - [#8](https://github.com/liuderchi/gh-template-bot/pull/8) Refine docs and Config (@liuderchi) 32 | - [20f3988](https://github.com/liuderchi/gh-template-bot/commit/20f39882e36885fb1800affd2d90aac0b33c722f) turn off prettier in eslintrc (@liuderchi) 33 | - [88af984](https://github.com/liuderchi/gh-template-bot/commit/88af984d933d4847c1a48053202aaeded3bca11e) fix travis.yml to build on master branches rather than feature branches (@liuderchi) 34 | - [db25731](https://github.com/liuderchi/gh-template-bot/commit/db25731b7488eecfe43fda04b52e9675cc45b36a) refine usage, add installation guide in README (@liuderchi) 35 | - [#7](https://github.com/liuderchi/gh-template-bot/pull/7) Chores for CI and Enhance DX (@liuderchi) 36 | - [7c34250](https://github.com/liuderchi/gh-template-bot/commit/7c342504f61d213ef0ff5a711559812f1a414cf1) move js codes to create src/ folder (@liuderchi) 37 | - [361780c](https://github.com/liuderchi/gh-template-bot/commit/361780c06ca06592cd18f9e7e045e544ee8445b2) refine README, add badges (@liuderchi) 38 | - [62e0d5b](https://github.com/liuderchi/gh-template-bot/commit/62e0d5bc6c7bd33809d060f37c2c211e82d79b9f) introduce prettier (@liuderchi) 39 | - [d5a06d1](https://github.com/liuderchi/gh-template-bot/commit/d5a06d16fe8cd92b00d64be5f9b6abe5c3c5db3d) introduce eslint, fix lint error (@liuderchi) 40 | - [15a8926](https://github.com/liuderchi/gh-template-bot/commit/15a89264427f95bb5a33bad71c25e02b230f3476) add CHANGELOG.md, introduce github-changes (@liuderchi) 41 | 42 | ### v0.1.0-alpha (2017/11/11 18:23 +00:00) 43 | - [#4](https://github.com/liuderchi/gh-template-bot/pull/4) Doc for alpha release (@liuderchi) 44 | - [a459619](https://github.com/liuderchi/gh-template-bot/commit/a45961914fea06edd2c0dccf8cc3f8565a82bb5c) refine README, description in package.json (@liuderchi) 45 | - [09a35e2](https://github.com/liuderchi/gh-template-bot/commit/09a35e213c9eff257ca9b7eff8e7a0e2b7453441) update .env.example to fix local run failure (@liuderchi) 46 | - [c372ae1](https://github.com/liuderchi/gh-template-bot/commit/c372ae1f89d17279d199d7bcf311de74aa9cb78e) add logo.svg, logo.png (300 dpi) (@liuderchi) 47 | - [#3](https://github.com/liuderchi/gh-template-bot/pull/3) Deploy to Heroku Manually (@liuderchi) 48 | - [770c3be](https://github.com/liuderchi/gh-template-bot/commit/770c3bede4da512be12aa200fdd8ffc9ea7369f3) add jobs/deploy-heroku.sh (@liuderchi) 49 | - [58bf04b](https://github.com/liuderchi/gh-template-bot/commit/58bf04bf0d4ae281bbc4a8cc9671dba8905ae2ef) fix node version in package.json (@liuderchi) 50 | - [#2](https://github.com/liuderchi/gh-template-bot/pull/2) Handle Issue and PR Webhook (@liuderchi) 51 | - [ff3b44e](https://github.com/liuderchi/gh-template-bot/commit/ff3b44e645ca57cfd161ecddec75d2e72ccab82a) handle PR webhook (@liuderchi) 52 | - [254ebec](https://github.com/liuderchi/gh-template-bot/commit/254ebec545e5ebedf81a2c71240566a1654ffbce) handle issue webhook (@liuderchi) 53 | - [ad95050](https://github.com/liuderchi/gh-template-bot/commit/ad95050c78ff11e898ef4e73ecd2ba7638ea63fa) add simple templates (@liuderchi) 54 | - [140ca20](https://github.com/liuderchi/gh-template-bot/commit/140ca20c9074bef4530dedfcccf1a137e4337325) update `APP_ID`, `PRIVATE_KEY` in .env.example (@liuderchi) 55 | - [cd9fee9](https://github.com/liuderchi/gh-template-bot/commit/cd9fee91d0fb206e0ae470e0bb1a3132123ba3aa) install ramda, add `jest` to `scripts` in package.json (@liuderchi) 56 | - [#1](https://github.com/liuderchi/gh-template-bot/pull/1) Create Probot App (@liuderchi) 57 | - [8675418](https://github.com/liuderchi/gh-template-bot/commit/86754183613e1475e126b5ad9504956aca1f12ca) install nodemon, add `start:nodemon` to `scripts` in package.json (@liuderchi) 58 | - [34dc7b5](https://github.com/liuderchi/gh-template-bot/commit/34dc7b5df47e71f9c04a0a41bf57e4bbee98f6ca) add yarn.lock to .gitignore (@liuderchi) 59 | - [5e827fe](https://github.com/liuderchi/gh-template-bot/commit/5e827fe3e5601ddb94900a68ea7f1dcd3ae1178b) revert LICENSE changes (@liuderchi) 60 | - [d9b8d0d](https://github.com/liuderchi/gh-template-bot/commit/d9b8d0d7dd9f2b3ce352f4ce7b650fa4e5899c6c) npm install -g create-probot-app && create-probot-app gh-template-bot (@liuderchi) 61 | - [993a6d2](https://github.com/liuderchi/gh-template-bot/commit/993a6d2eb8f211c2313491e604551e765e465da4) Initial commit (@liuderchi) -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | 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, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | 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. 28 | 29 | 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. 30 | 31 | ## Scope 32 | 33 | 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. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at liuderchi@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems 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. 38 | 39 | 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. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | [fork]: /fork 4 | [pr]: /compare 5 | [style]: https://standardjs.com/ 6 | [code-of-conduct]: CODE_OF_CONDUCT.md 7 | 8 | Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. 9 | 10 | 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. 11 | 12 | ## Submitting a pull request 13 | 14 | 1. [Fork][fork] and clone the repository 15 | 1. Configure and install the dependencies: `npm install` 16 | 1. Make sure the tests pass on your machine: `npm test`, note: these tests also apply the linter, so no need to lint seperately 17 | 1. Create a new branch: `git checkout -b my-branch-name` 18 | 1. Make your change, add tests, and make sure the tests still pass 19 | 1. Push to your fork and [submit a pull request][pr] 20 | 1. Pat your self on the back and wait for your pull request to be reviewed and merged. 21 | 22 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: 23 | 24 | - Follow the [style guide][style] which is using standard. Any linting errors should be shown when running `npm test` 25 | - Write and update tests. 26 | - Keep your change 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. 27 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 28 | 29 | Work in Progress pull request are also welcome to get feedback early on, or if there is something blocked you. 30 | 31 | ## Resources 32 | 33 | - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) 34 | - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) 35 | - [GitHub Help](https://help.github.com) 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Te-Chi Liu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |