|
| 1 | +# @tunnckocore/circleci [![npm version][npmv-img]][npmv-url] [![github release][ghrelease-img]][ghrelease-url] [![License][license-img]][license-url] |
| 2 | + |
| 3 | +> Small and simple CircleCI client library to requesting the API and authorization via token |
| 4 | +
|
| 5 | +Please consider following this project's author, [Charlike Mike Reagent](https://github.com/tunnckoCore), and :star: the project to show your :heart: and support. |
| 6 | + |
| 7 | +<div id="thetop"></div> |
| 8 | + |
| 9 | +[![Code style][codestyle-img]][codestyle-url] |
| 10 | +[![CircleCI linux build][linuxbuild-img]][linuxbuild-url] |
| 11 | +[![CodeCov coverage status][codecoverage-img]][codecoverage-url] |
| 12 | +[![DavidDM dependency status][dependencies-img]][dependencies-url] |
| 13 | +[![Renovate App Status][renovateapp-img]][renovateapp-url] |
| 14 | +[![Make A Pull Request][prs-welcome-img]][prs-welcome-url] |
| 15 | +[![Semantically Released][new-release-img]][new-release-url] |
| 16 | + |
| 17 | +If you have any _how-to_ kind of questions, please read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents. |
| 18 | +For bugs reports and feature requests, [please create an issue][open-issue-url] or ping |
| 19 | +[@tunnckoCore](https://twitter.com/tunnckoCore) at Twitter. |
| 20 | + |
| 21 | +[![Become a Patron][patreon-img]][patreon-url] |
| 22 | +[![Conventional Commits][ccommits-img]][ccommits-url] |
| 23 | +[![NPM Downloads Weekly][downloads-weekly-img]][npmv-url] |
| 24 | +[![NPM Downloads Monthly][downloads-monthly-img]][npmv-url] |
| 25 | +[![NPM Downloads Total][downloads-total-img]][npmv-url] |
| 26 | +[![Share Love Tweet][shareb]][shareu] |
| 27 | + |
| 28 | +Project is [semantically](https://semver.org) & automatically released on [CircleCI](https://circleci.com) with [new-release][] and its [New Release](https://github.com/apps/new-release) GitHub App. |
| 29 | + |
| 30 | +<!-- Logo when needed: |
| 31 | +
|
| 32 | +<p align="center"> |
| 33 | + <a href="https://github.com/tunnckoCoreLabs/circleci"> |
| 34 | + <img src="./media/logo.png" width="85%"> |
| 35 | + </a> |
| 36 | +</p> |
| 37 | +
|
| 38 | +--> |
| 39 | + |
| 40 | +## Table of Contents |
| 41 | + |
| 42 | +- [Install](#install) |
| 43 | +- [API](#api) |
| 44 | + * [src/index.js](#srcindexjs) |
| 45 | + + [circleci](#circleci) |
| 46 | +- [See Also](#see-also) |
| 47 | +- [Contributing](#contributing) |
| 48 | + * [Follow the Guidelines](#follow-the-guidelines) |
| 49 | + * [Support the project](#support-the-project) |
| 50 | + * [OPEN Open Source](#open-open-source) |
| 51 | + * [Wonderful Contributors](#wonderful-contributors) |
| 52 | +- [License](#license) |
| 53 | + |
| 54 | +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ |
| 55 | + |
| 56 | +## Install |
| 57 | + |
| 58 | +This project requires [**Node.js**](https://nodejs.org) **^8.11.0 || >=10.13.0**. Install it using |
| 59 | +[**yarn**](https://yarnpkg.com) or [**npm**](https://npmjs.com). |
| 60 | +_We highly recommend to use Yarn when you think to contribute to this project._ |
| 61 | + |
| 62 | +```bash |
| 63 | +$ yarn add @tunnckocore/circleci |
| 64 | +``` |
| 65 | + |
| 66 | +## API |
| 67 | + |
| 68 | +<!-- docks-start --> |
| 69 | +_Generated using [docks](http://npm.im/docks)._ |
| 70 | + |
| 71 | +### [src/index.js](/src/index.js) |
| 72 | + |
| 73 | +#### [circleci](/src/index.js#L41) |
| 74 | +Currently only supports `POST` request to the API, so endpoints |
| 75 | +such as `/follow` and `/build` are working, but not `/me` because |
| 76 | +it needs a `GET` request. Basically what this module is doing |
| 77 | +by default is that you pass a `options.repository` and `options.token`, |
| 78 | +and it "follows" (e.g. enables) a CircleCI service on that repository. |
| 79 | +The token also can be passed as `options.circleci_token` or as |
| 80 | +an environment variable `process.env.CIRCLE_CI`. |
| 81 | + |
| 82 | +If you want to trigger a build, instead of enabling a project, |
| 83 | +then pass second parameter `'build'`. |
| 84 | + |
| 85 | +**Params** |
| 86 | +- `[options]` **{object}** optional, pass `options.repository` and `options.token` |
| 87 | +- `[type]` **{string}** type of action, by default `'follow'` |
| 88 | + |
| 89 | +**Returns** |
| 90 | +- `Promise<object>` response from the api, requested with [axios][] |
| 91 | + |
| 92 | +**Examples** |
| 93 | +```javascript |
| 94 | +import circleci from '@tunnckocore/circleci'; |
| 95 | + |
| 96 | +async function main() { |
| 97 | + const options = { repository: 'tunnckoCoreLabs/foobar', token: 'XXX' }; |
| 98 | + const resultOfFollow = await circleci(options); |
| 99 | + console.log(resultOfFollow); |
| 100 | + |
| 101 | + const triggeredBuild = await circleci(options, 'build'); |
| 102 | + console.log(triggeredBuild) |
| 103 | +} |
| 104 | + |
| 105 | +main().catch(console.error); |
| 106 | +``` |
| 107 | + |
| 108 | +<!-- docks-end --> |
| 109 | + |
| 110 | +**[back to top](#thetop)** |
| 111 | + |
| 112 | +## See Also |
| 113 | + |
| 114 | +Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your |
| 115 | +existance! |
| 116 | +- [@tunnckocore/config](https://www.npmjs.com/package/@tunnckocore/config): All the configs for all the tools, in one place | [homepage](https://github.com/tunnckoCoreLabs/config "All the configs for all the tools, in one place") |
| 117 | +- [@tunnckocore/create-project](https://www.npmjs.com/package/@tunnckocore/create-project): Create and scaffold a new project, its GitHub repository and… [more](https://github.com/tunnckoCoreLabs/create-project) | [homepage](https://github.com/tunnckoCoreLabs/create-project "Create and scaffold a new project, its GitHub repository and contents") |
| 118 | +- [@tunnckocore/execa](https://www.npmjs.com/package/@tunnckocore/execa): Thin layer on top of [execa][] that allows executing multiple… [more](https://github.com/tunnckoCoreLabs/execa) | [homepage](https://github.com/tunnckoCoreLabs/execa "Thin layer on top of [execa][] that allows executing multiple commands in parallel or in sequence") |
| 119 | +- [@tunnckocore/scripts](https://www.npmjs.com/package/@tunnckocore/scripts): Universal and minimalist scripts & tasks runner. | [homepage](https://github.com/tunnckoCoreLabs/scripts "Universal and minimalist scripts & tasks runner.") |
| 120 | +- [@tunnckocore/update](https://www.npmjs.com/package/@tunnckocore/update): Update a repository with latest templates from `charlike`. | [homepage](https://github.com/tunnckoCoreLabs/update "Update a repository with latest templates from `charlike`.") |
| 121 | +- [asia](https://www.npmjs.com/package/asia): Blazingly fast, magical and minimalist testing framework, for Today and… [more](https://github.com/olstenlarck/asia#readme) | [homepage](https://github.com/olstenlarck/asia#readme "Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow") |
| 122 | +- [charlike](https://www.npmjs.com/package/charlike): Small & fast project scaffolder with sane defaults. Supports hundreds… [more](https://github.com/tunnckoCoreLabs/charlike) | [homepage](https://github.com/tunnckoCoreLabs/charlike "Small & fast project scaffolder with sane defaults. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options") |
| 123 | +- [docks](https://www.npmjs.com/package/docks): Extensible system for parsing and generating documentation. It just freaking… [more](https://github.com/tunnckoCore/docks) | [homepage](https://github.com/tunnckoCore/docks "Extensible system for parsing and generating documentation. It just freaking works!") |
| 124 | +- [gitcommit](https://www.npmjs.com/package/gitcommit): Lightweight and joyful `git commit` replacement. Conventional Commits compliant. | [homepage](https://github.com/tunnckoCore/gitcommit "Lightweight and joyful `git commit` replacement. Conventional Commits compliant.") |
| 125 | + |
| 126 | +**[back to top](#thetop)** |
| 127 | + |
| 128 | +## Contributing |
| 129 | + |
| 130 | +### Follow the Guidelines |
| 131 | + |
| 132 | +Please read the [Contributing Guide](./CONTRIBUTING.md) and [Code of Conduct](./CODE_OF_CONDUCT.md) documents for advices. |
| 133 | +For bugs reports and feature requests, [please create an issue][open-issue-url] or ping |
| 134 | +[@tunnckoCore](https://twitter.com/tunnckoCore) at Twitter. |
| 135 | + |
| 136 | +### Support the project |
| 137 | + |
| 138 | +[Become a Partner or Sponsor?][patreon-url] :dollar: Check the **Partner**, **Sponsor** or **Omega-level** tiers! :tada: You can get your company logo, link & name on this file. It's also rendered on package page in [npmjs.com][npmv-url] and [yarnpkg.com](https://yarnpkg.com/en/package/@tunnckocore/circleci) sites too! :rocket: |
| 139 | + |
| 140 | +Not financial support? Okey! [Pull requests](https://github.com/tunnckoCoreLabs/contributing#opening-a-pull-request), stars and all kind of [contributions](https://opensource.guide/how-to-contribute/#what-it-means-to-contribute) are always |
| 141 | +welcome. :sparkles: |
| 142 | + |
| 143 | +### OPEN Open Source |
| 144 | + |
| 145 | +This project is following [OPEN Open Source](http://openopensource.org) model |
| 146 | + |
| 147 | +> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is built on collective efforts and it's not strongly guarded by its founders. |
| 148 | +
|
| 149 | +There are a few basic ground-rules for its contributors |
| 150 | + |
| 151 | +1. Any **significant modifications** must be subject to a pull request to get feedback from other contributors. |
| 152 | +2. [Pull requests](https://github.com/tunnckoCoreLabs/contributing#opening-a-pull-request) to get feedback are _encouraged_ for any other trivial contributions, but are not required. |
| 153 | +3. Contributors should attempt to adhere to the prevailing code-style and development workflow. |
| 154 | + |
| 155 | +### Wonderful Contributors |
| 156 | + |
| 157 | +Thanks to the hard work of these wonderful people this project is alive! It follows the |
| 158 | +[all-contributors](https://github.com/kentcdodds/all-contributors) specification. |
| 159 | +Don't hesitate to add yourself to that list if you have made any contribution! ;) [See how, |
| 160 | +here](https://github.com/jfmengels/all-contributors-cli#usage). |
| 161 | + |
| 162 | +<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> |
| 163 | +<!-- prettier-ignore --> |
| 164 | +| [<img src="https://avatars3.githubusercontent.com/u/5038030?v=4" width="120px;"/><br /><sub><b>Charlike Mike Reagent</b></sub>](https://tunnckocore.com)<br />[💻](https://github.com/tunnckoCoreLabs/circleci/commits?author=tunnckoCore "Code") [📖](https://github.com/tunnckoCoreLabs/circleci/commits?author=tunnckoCore "Documentation") [💬](#question-tunnckoCore "Answering Questions") [👀](#review-tunnckoCore "Reviewed Pull Requests") [🔍](#fundingFinding-tunnckoCore "Funding Finding") | |
| 165 | +| :---: | |
| 166 | + |
| 167 | +<!-- ALL-CONTRIBUTORS-LIST:END --> |
| 168 | + |
| 169 | +Consider showing your [support](#support-the-project) to them. :sparkling_heart: |
| 170 | + |
| 171 | +## License |
| 172 | + |
| 173 | +Copyright (c) 2018-present, [Charlike Mike Reagent](https://tunnckocore.com) `<mameto2011@gmail.com>` & [contributors](#wonderful-contributors). |
| 174 | +Released under the [Apache-2.0 License][license-url]. |
| 175 | + |
| 176 | +<!-- Heading badges --> |
| 177 | + |
| 178 | +[npmv-url]: https://www.npmjs.com/package/@tunnckocore/circleci |
| 179 | +[npmv-img]: https://badgen.net/npm/v/@tunnckocore/circleci?icon=npm |
| 180 | + |
| 181 | +[ghrelease-url]: https://github.com/tunnckoCoreLabs/circleci/releases/latest |
| 182 | +[ghrelease-img]: https://badgen.net/github/release/tunnckoCoreLabs/circleci?icon=github |
| 183 | + |
| 184 | +[license-url]: https://github.com/tunnckoCoreLabs/circleci/blob/master/LICENSE |
| 185 | +[license-img]: https://badgen.net/npm/license/@tunnckocore/circleci |
| 186 | + |
| 187 | +<!-- Front line badges --> |
| 188 | + |
| 189 | +[codestyle-url]: https://github.com/airbnb/javascript |
| 190 | +[codestyle-img]: https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb |
| 191 | + |
| 192 | +[linuxbuild-url]: https://circleci.com/gh/tunnckoCoreLabs/circleci/tree/master |
| 193 | +[linuxbuild-img]: https://badgen.net/circleci/github/tunnckoCoreLabs/circleci/master?label=build&icon=circleci |
| 194 | + |
| 195 | +[codecoverage-url]: https://codecov.io/gh/tunnckoCoreLabs/circleci |
| 196 | +[codecoverage-img]: https://badgen.net/codecov/c/github/tunnckoCoreLabs/circleci?icon=codecov |
| 197 | + |
| 198 | +[dependencies-url]: https://david-dm.org/tunnckoCoreLabs/circleci |
| 199 | +[dependencies-img]: https://badgen.net/david/dep/tunnckoCoreLabs/circleci?label=deps |
| 200 | + |
| 201 | +[ccommits-url]: https://conventionalcommits.org/ |
| 202 | +[ccommits-img]: https://badgen.net/badge/conventional%20commits/v1.0.0/dfb317 |
| 203 | +[new-release-url]: https://ghub.io/new-release |
| 204 | +[new-release-img]: https://badgen.net/badge/semantically/released/05c5ff |
| 205 | + |
| 206 | +[downloads-weekly-img]: https://badgen.net/npm/dw/@tunnckocore/circleci |
| 207 | +[downloads-monthly-img]: https://badgen.net/npm/dm/@tunnckocore/circleci |
| 208 | +[downloads-total-img]: https://badgen.net/npm/dt/@tunnckocore/circleci |
| 209 | + |
| 210 | +[renovateapp-url]: https://renovatebot.com |
| 211 | +[renovateapp-img]: https://badgen.net/badge/renovate/enabled/green |
| 212 | +[prs-welcome-img]: https://badgen.net/badge/PRs/welcome/green |
| 213 | +[prs-welcome-url]: http://makeapullrequest.com |
| 214 | +[paypal-donate-url]: https://paypal.me/tunnckoCore/10 |
| 215 | +[paypal-donate-img]: https://badgen.net/badge/$/support/purple |
| 216 | +[patreon-url]: https://www.patreon.com/bePatron?u=5579781 |
| 217 | +[patreon-img]: https://badgen.net/badge/patreon/tunnckoCore/F96854?icon=patreon |
| 218 | +[patreon-sponsor-img]: https://badgen.net/badge/become/a%20sponsor/F96854?icon=patreon |
| 219 | + |
| 220 | +[shareu]: https://twitter.com/intent/tweet?text=https://github.com/tunnckoCoreLabs/circleci&via=tunnckoCore |
| 221 | +[shareb]: https://badgen.net/badge/twitter/share/1da1f2?icon=twitter |
| 222 | +[open-issue-url]: https://github.com/tunnckoCoreLabs/circleci/issues/new |
| 223 | + |
| 224 | +[axios]: https://github.com/axios/axios |
| 225 | +[execa]: https://github.com/sindresorhus/execa |
| 226 | +[new-release]: https://github.com/tunnckoCore/new-release |
| 227 | +[semantic-release]: https://github.com/semantic-release/semantic-release |
0 commit comments