github

package
v0.0.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

README

GitHub

Actions for github.com

github.create_issue

This action creates an issue in the specified GitHub repository to serve as an alert handling ticket.

Prerequisite

You need to create a GitHub App. You can find instructions on how to do so here.

The GitHub App requires Read and Write permissions for Issues, and you need to install it into the target repository.

Arguments

Example policy:

run[res] {
  res := {
    id: "your-action",
    uses: "github.create_issue",
    args: {
      "app_id": 134650,
      "install_id": 19102538,
      "owner": "m-mizutani",
      "repo": "security-alert",
      "secret_private_key": input.env.GITHUB_PRIVATE_KEY,
    },
  },
}
  • app_id (number, required): Specifies the ID of the GitHub App.
  • install_id (number, required): Specifies the installation ID of the GitHub account where the action will be executed.
  • owner (string, required): Specifies the owner name of the GitHub account where the action will be executed.
  • repo (string, required): Specifies the repository name of the GitHub account where the action will be executed.
  • secret_private_key (string, required): Specifies the private key of the GitHub App.
  • assignee (string, optional): Specifies the GitHub user to be assigned to the issue.
  • labels (array of strings, optional): Specifies the labels to be applied to the issue.

Note: If you wish to use assignee or labels, the GitHub App must also have Read and Write permissions for Content.

Response

See https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue

github.create_comment

This action creates an issue comment in the specified GitHub repository issue.

Prerequisite

You need to create a GitHub App. You can find instructions on how to do so here.

The GitHub App requires Read and Write permissions for Issues, and you need to install it into the target repository.

Arguments

Example policy:

run[res] {
  res := {
    id: "your-action",
    uses: "github.create_issue",
    args: {
      "app_id": 134650,
      "install_id": 19102538,
      "owner": "m-mizutani",
      "repo": "security-alert",
      "issue_number": 1,
      "secret_private_key": input.env.GITHUB_PRIVATE_KEY,
      "body": "This is a test comment.",
    },
  },
}
  • app_id (number, required): Specifies the ID of the GitHub App.
  • install_id (number, required): Specifies the installation ID of the GitHub account where the action will be executed.
  • owner (string, required): Specifies the owner name of the GitHub account where the action will be executed.
  • repo (string, required): Specifies the repository name of the GitHub account where the action will be executed.
  • secret_private_key (string, required): Specifies the private key of the GitHub App.
  • body (string, required): Specifies the body of the comment.
Response

See https://docs.github.com/en/rest/issues/comments?apiVersion=2022-11-28#create-an-issue-comment

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateComment added in v0.0.7

func CreateComment(ctx *model.Context, alert model.Alert, args model.ActionArgs) (any, error)

func CreateIssue

func CreateIssue(ctx *model.Context, alert model.Alert, args model.ActionArgs) (any, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL