Skip to content

Commit

Permalink
feat: initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpshr committed Dec 8, 2019
0 parents commit b2d5e0a
Show file tree
Hide file tree
Showing 19 changed files with 7,504 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
version: 2
jobs:
checkout:
docker:
- image: circleci/node:12-browsers
working_directory: ~/repo
steps:
- checkout
- persist_to_workspace:
root: ~/repo
paths: .

install:
docker:
- image: circleci/node:12-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v2-yarn-dependencies-{{ checksum "yarn.lock" }}
- v2-yarn-dependencies- # fallback to latest cache if no exact match is found
- run: yarn install --frozen-lockfile
- save_cache:
key: v2-yarn-dependencies-{{ checksum "yarn.lock" }}
paths:
- node_modules
- .yarn-cache

lint:
docker:
- image: circleci/node:12-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v2-yarn-dependencies-{{ checksum "yarn.lock" }}
- v2-yarn-dependencies- # fallback to latest cache if no exact match is found
- run: yarn lint

test:
docker:
- image: circleci/node:12-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v2-yarn-dependencies-{{ checksum "yarn.lock" }}
- v2-yarn-dependencies- # fallback to latest cache if no exact match is found
- run: yarn zapier:test

publish:
docker:
- image: circleci/node:12-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: ~/repo
- restore_cache:
keys:
- v2-yarn-dependencies-{{ checksum "yarn.lock" }}
- v2-yarn-dependencies- # fallback to latest cache if no exact match is found
- run: echo '{"deployKey":"$ZAPIER_DEPLOY_KEY"}' > ~/.zapierrc && yarn zapier:push

tagged: &tagged
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/

any: &any
filters:
tags:
only: /.*/

workflows:
version: 2
build:
jobs:
- checkout:
<<: *any
- install:
<<: *any
requires:
- checkout
- lint:
<<: *any
requires:
- install
- test:
<<: *any
requires:
- install
- publish:
<<: *tagged
requires:
- lint
- test
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.log
.DS_Store
.yarn-cache
build
coverage
node_modules
package-lock.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.4.0
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- 8.10.0
before_script: 'npm install -g zapier-platform-cli'
script: 'zapier test'
notifications:
email: false
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"javascript.validate.enable": false
}
4 changes: 4 additions & 0 deletions .zapierapprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"id": 74968,
"key": "App74968"
}
77 changes: 77 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

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.

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.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
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.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at support@abstract.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and 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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

81 changes: 81 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Contributing to the abstract-zapier

We're very grateful for outside contributions, as they both improve the robustness of this Zapier integration and help inform how this integration is being used in real-world applications. Whether the contribution is a minor documentation fix or major feature enhancement, we're always happy to accept changes that adhere to the expectations in this document.

## Code of conduct

Please note that this project adheres to a [code of conduct](https://github.com/goabstract/abstract-zapier/blob/master/CODE_OF_CONDUCT.md).

## Submitting an issue

Please follow the provided template when [submitting an issue](https://github.com/goabstract/abstract-zapier/issues/new).

## Submitting a pull request

Please follow the provided template when [submitting a pull request](https://github.com/goabstract/abstract-zapier/compare).

## Local development

The the codebase is written using modern JavaScript language features. The commands below (and repository as a whole) use Yarn, but both Yarn and NPM can be used interchangeably depending on developer preference.

### Setup

Fork and clone the repository:

```sh
$ git clone https://github.com/<username>/abstract-zapier
```

### Installation

Install dependencies from the project root using Yarn:

```sh
$ cd abstract-zapier && yarn
```

### Building

Build the integration using the `zapier` CLI:

```sh
$ yarn build
```

### Linting

Lint and format all code using Prettier via ESLint:

```sh
$ yarn lint --fix
```

### Testing

Run unit tests using the `zapier` CLI:

```sh
$ yarn test
```

## Cutting releases

New package versions of `abstract-zapier` are automatically published to the Zapier platform whenever new tags are pushed to the repository. This repository uses [`standard-version`](https://github.com/conventional-changelog/standard-version) as convention to automate versioning, tagging, and changelog generation:

```sh
$ yarn release
$ git push origin master --follow-tags
```

Or cut a pre-release:

```sh
$ yarn release --prerelease alpha
$ git push origin master --follow-tags
```

<br />
<br />
<br />
<br />
<img src="https://www.abstract.com/wp-content/uploads/abstract-black-wordmark-rgb.png" width="136" height="auto" />
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Elastic Projects, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<img src="https://www.abstract.com/wp-content/uploads/abstract-black-wordmark-rgb.png" width="136" height="auto" />

`abstract-zapier` is the official Abstract integration for Zapier.

[![build status](https://img.shields.io/circleci/project/github/goabstract/abstract-zapier.svg)](https://circleci.com/gh/goabstract/abstract-zapier)

## Installation

Check out [Abstract on Zapier](https://zapier.com/apps/abstract/integrations) for more information and installation instructions.

## Contributing

This project is maintained by a team at [Abstract](https://www.abstract.com). Outside contributions are highly encouraged, but please ensure that a relevant [issue](https://github.com/goabstract/abstract-zapier/issues) exists and that an approach has been discussed before beginning to write code. This makes it more likely that your contribution will be accepted and ensures that your time is not wasted.

Please see the [contributors guide](CONTRIBUTING.md) for more information.

## License

[MIT](LICENSE)
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { version: platformVersion } = require("zapier-platform-core");
const authentication = require("./lib/authentication");
const branchCreated = require("./lib/triggers/branchCreated");
const organizationsExist = require("./lib/triggers/organizationsExist");
const { version } = require("./package.json");

const AbstractZap = {
platformVersion,
version,

authentication: authentication.config,
beforeRequest: [authentication.addApiKeyToHeader],

triggers: {
[branchCreated.key]: branchCreated,
[organizationsExist.key]: organizationsExist
}
};

module.exports = AbstractZap;
29 changes: 29 additions & 0 deletions lib/authentication.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const addApiKeyToHeader = (request, _, bundle) => {
request.headers["Content-Type"] = "application/json";
request.headers["Accept"] = "application/json";
request.headers["Abstract-Api-Version"] = "17";
request.headers.Authorization = `Bearer ${bundle.authData.api_token}`;
return request;
};

const config = {
type: "custom",
test: {
url: "https://api.goabstract.com/me"
},
fields: [
{
key: "api_token",
label: "Abstract API token",
type: "string",
required: true,
helpText: "Create a token at https://app.abstract.com/account/tokens."
}
],
connectionLabel: (_, bundle) => `username: ${bundle.inputData.user.username}`
};

module.exports = {
addApiKeyToHeader,
config
};
Loading

0 comments on commit b2d5e0a

Please sign in to comment.