drone-render

    1.0.4 • 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

    1

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    9

    Last publish

    Collaborators

    • lizheming