Socket
Socket
Sign inDemoInstall

reg-notify-github-with-api-plugin

Package Overview
Dependencies
137
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.11.0 to 0.11.1

2

lib/gh-api-notifier-plugin.d.ts

@@ -8,2 +8,3 @@ import { NotifierPlugin, NotifyParams, PluginCreateOptions } from "reg-suit-interface";

shortDescription?: boolean;
ref?: string;
}

@@ -19,4 +20,5 @@ export declare class GhApiNotifierPlugin implements NotifierPlugin<GhApiPluginOption> {

private _shortDescription;
private _ref?;
init(config: PluginCreateOptions<GhApiPluginOption>): void;
notify(params: NotifyParams): Promise<void>;
}

@@ -33,2 +33,3 @@ "use strict";

this._shortDescription = config.options.shortDescription || false;
this._ref = config.options.ref;
}

@@ -49,3 +50,2 @@ notify(params) {

}
const head = this._repo.readHeadSync();
const commentBody = (0, create_comment_1.createCommentBody)({

@@ -60,3 +60,19 @@ reportUrl: params.reportUrl,

const client = new gh_gql_client_1.GhGqlClient(this._token, this._githubUrl);
if (head.type !== "branch" || !head.branch) {
let branchName = undefined;
if (this._ref) {
if (!this._ref.startsWith("refs/heads")) {
this._logger.warn(`ref option does not start with 'refs/heads': "${this._ref}"`);
return;
}
branchName = this._ref.replace(/^refs\/heads/, "");
}
else {
const head = this._repo.readHeadSync();
if (head.type !== "branch" || !head.branch) {
this._logger.warn("Can't detect branch name.");
return;
}
branchName = head.branch.name;
}
if (!branchName) {
this._logger.warn("Can't detect branch name.");

@@ -68,3 +84,3 @@ return;

repository: this._repository,
branchName: head.branch.name,
branchName,
body: commentBody,

@@ -71,0 +87,0 @@ });

4

package.json
{
"name": "reg-notify-github-with-api-plugin",
"version": "0.11.0",
"version": "0.11.1",
"description": "Notify reg-suit result to GHE repository using API",

@@ -38,3 +38,3 @@ "main": "lib/index.js",

},
"gitHead": "d56533ed3568cc81e12bae228059bfa04df99d72"
"gitHead": "4eca699b9b64f18468e22bd736340e77040f7db4"
}

@@ -23,2 +23,4 @@ # reg-notify-github-with-api-plugin

privateToken: string;
ref?: string;
shortDescription?: boolean;
}

@@ -31,2 +33,3 @@ ```

- `privateToken` - _Required_ Private access token. The `repo` scope is required if the repository is private.
- `ref` - _Optional_ Git branch ref value. If specified, this plugin searches PRs to comment using this value.
- `shortDescription` - _Optional_ Returns a small table with the item counts.

@@ -33,0 +36,0 @@ Example:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc