Need private packages and team management tools?Check out npm Teams »

drone-render

1.0.2 • Public • Published

drone-render

npm Travis Coveralls David

Render template with CI enviroment injected by Drone CI.

Installation

npm install drone-render --save

How To Use

 
const render = require('drone-render');
render(`
{% if build.status %}
  {{build.finished | datetime('fromNow')}} build {{build.number}} succeeded. Good job {{build.author}}.
{% else %}
  build {{build.number}} failed at {{build.finished | datetime}}. Fix me please.
{% endif %}
`);
 
//output
//a day ago build 20 succeeded. Good job lord.

Template Reference

  • repo.owner: repository owner
  • repo.name: repository name
  • build.status: build status type enumeration, either success or failure
  • build.event: build event type enumeration, one of push, pull_request, tag, deployment
  • build.number: build number
  • build.commit: git sha for current commit
  • build.message: commit message for the current build
  • build.branch: git branch for current commit
  • build.tag: git tag for current commit
  • build.ref: git ref for current commit
  • build.pull_request: pull request number for the current build
  • build.source_branch: source branch for a pull request
  • build.target_branch: target branch for a pull request
  • build.author: git author for current commit
  • build.link: link the the build results in drone
  • build.started: unix timestamp for build started
  • build.finished: unix timestamp for build finished

Template Filter

  • uppercasefirst: converts the first letter of a string to uppercase
  • datetime: converts a unix timestamp to a date time string. Example {{build.started | datetime}}, you can see more info in nunjucks-date-filter
  • More filter can see builtin-filters

Contributing

Contributions welcome!

License

MIT

Install

npm i drone-render

DownloadsWeekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

12.9 kB

Total Files

9

Last publish

Collaborators

  • avatar