Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eng-automation/integrations

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eng-automation/integrations

Parity EngAutomation reusable third party integrations

  • 4.4.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-66.67%
Maintainers
2
Weekly downloads
 
Created
Source

opstooling-integrations

Reusable third party integrations library

All integrations are unified under similar API, with following rules in mind:

  • Setup/configuration is supported in two ways:
    • Automatic (static): all options are in environment variables, and setup is performed on first execution of any method.
    • Manual: use getInstance(opts) method from an integration, and pass the instance as a parameter to each method. This allows to have more than one instance of integration. One example why this is needed, are installation-authenticated instances of github in cla-bot-2021.
  • Mocks are provided for each query, but fixtures are added when needed.
  • All retry / rate-limiting logic should also be implemented in this module.
Using mocks and fixtures
// module.ts
import { github } from "opstooling-integrations";

export async function foo() {
  await github.createCommitStatus({...});
}
// module.spec.ts
import { describe, expect, it, jest } from "@jest/globals";
import { fixtures, github } from "opstooling-integrations";
import { foo } from ".";

jest.mock("opstooling-integrations");

describe("foo", () => {
  it("calls github.createCommitStatus", async () => {
  jest.mocked(github.createCommitStatus).mockResolvedValue(fixtures.github.createCommitStatusSuccessfulResponse());
    await foo();

    expect(github.createCommitStatus).toHaveBeenCalledWith({...});
  });
});

Integrations

GitHub

Configuration

Four auth types are supported: app, installation, and token.

app auth

Non-installation auth type for GitHub Apps. Using this means that org/repo permissions aren't accessible.
Requires appId and privateKey.

installation auth

This type is used to authorize requests for specific org/repo application installation. Requires installationId, which can be resolved using app auth. If app expected to have only one installation, then it can be configured through environment. Otherwise, use github.getInstance and pass the instance further.
Requires appId, privateKey and installationId.

token auth

Simplest of all, requires only token, works for personal tokens or oauth tokens.

Environment variableOption for getInstance()DescriptionRequired?Default value
GITHUB_AUTH_TYPEauthTypeapp, token, installationnotoken
GITHUB_APP_IDappIdGitHub app IDyes, if authType is app, or installation-
GITHUB_PRIVATE_KEY or GITHUB_PRIVATE_KEY_BASE64privateKeyGitHub app private key.
Use GITHUB_PRIVATE_KEY_BASE64 to curcumvent newline issues
yes, if authType is app or installation-
GITHUB_TOKENauthTokenGitHub auth token. Can be personal, oauth, etc.yes, if authType is token-
GITHUB_INSTALLATION_IDinstallationIdGitHub app installation idif authType is installation-
GITHUB_BASE_URLbaseUrlAPI endpoint URLnohttps://api.github.com

FAQs

Package last updated on 17 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc