circle-github-bot
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "circle-github-bot", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "CircleCI comments on github", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"build": "coffee --compile --output dist src", | ||
"check_version": "[[ \"${npm_package_version}\" = \"$(npm view ${npm_package_name} version)\" ]]" | ||
"check_version": "echo ${npm_package_version} $(npm view ${npm_package_name} version) | awk '{ if ($1 == $2) { print \"Duplicate version\"; exit 1 }}'" | ||
}, | ||
@@ -11,0 +11,0 @@ "repository": { |
# Circle Github Bot | ||
This library helps you submit a comment on the PR from inside your CircleCI | ||
build and link to a static artifact from the build. | ||
When reviewing a PR on github, it's useful to read the code but even more useful | ||
to test out the code on that branch in a live working web app. | ||
See an example PR on this github repo https://github.com/themadcreator/circle-github-bot/pull/3 | ||
It works like so: | ||
1. Someone creates a pull request on your github project | ||
1. This triggers a CircleCI build, which: | ||
1. Runs tests | ||
1. Builds your static demo site | ||
1. Runs your demo.js script, submitting a comment back to the PR | ||
1. A comment shows up on the github PR | ||
1. CircleCI "collects" the artifacts from the build and makes them available on the web | ||
1. You click the link on the PR and see the static site! | ||
# Setting Up Demo Comments on PRs | ||
### Write the Bot Script | ||
### Write the Bot Comment Script | ||
Create a `demo.js` script using this library to post a comment on github | ||
referencing the current PR. | ||
Create a script using this library to post a comment on github referencing | ||
the current PR. | ||
Example: | ||
@@ -16,6 +36,5 @@ ```javascript | ||
bot.comment(` | ||
<h3>${bot.env.commitMessage}</h3> | ||
Demo: <strong>${bot.artifactLink('/demo/index.html', 'demo')}</strong> | ||
<h3>${bot.env.commitMessage}</h3> | ||
Demo: <strong>${bot.artifactLink('demo/index.html', 'demo')}</strong> | ||
`); | ||
``` | ||
@@ -29,7 +48,11 @@ | ||
1. Settings > Integrations & Services > Services | ||
1. Once CircleCI is linked to your github account, it will add its own deploy key to this repo | ||
1. Once CircleCI is following your github project, it will add its own deploy key to this repo | ||
1. Add `circle.yml` file to the root of your repo | ||
1. Include your `demo/` directory in the `general.artifacts` list | ||
1. Include a section in `deployment` that generates your preview and posts the comment | ||
```yaml | ||
general: | ||
artifacts: | ||
- demo | ||
deployment: | ||
@@ -39,3 +62,3 @@ demo: | ||
commands: | ||
- ./demo/comment.js | ||
- ./demo.js | ||
``` | ||
@@ -52,3 +75,3 @@ | ||
### Enable CircleCI Build for PRs | ||
### Require CircleCI Build for PRs | ||
Optional, but helpful. This makes sure your builds actually pass before a PR can be submitted. | ||
@@ -55,0 +78,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17323
78