Github

1. Overview

GitHub is a cloud-based code hosting platform designed for developers to store, manage, track, and collaborate on software projects. It uses Git as its core version control system and provides powerful collaboration features such as issue tracking, code review, and continuous integration.

With GoInsight's Github node, you can seamlessly integrate repository management and automated operations into your workflows. This allows you to build powerful automation processes around code, issues, releases, and workflows, including:

  • Repository Management: Get detailed information, file lists, and license information for repositories, and search public repositories based on complex criteria.
  • File Operations: Create, read, update, and delete files in a specified repository.
  • Issue Management: Automatically create, edit, get, and lock issues in a repository, and add comments.
  • Release Management: Manage the full lifecycle of repository releases, including creating, getting, updating, and deleting.
  • Code Review: Create, get, and update reviews for a specified Pull Request.
  • Workflow Automation: Trigger (Dispatch), enable, disable, get, and monitor GitHub Actions workflows.
  • Collaboration Management: Invite users to become collaborators on a repository.

2. Prerequisites

Before using this node, you need to meet the following conditions:

  • Have a valid Github account.
  • Create a Personal Access Token (PAT) and grant it the necessary permissions for the operations you need (e.g., repo permission for reading/writing to private repositories, workflow permission for managing GitHub Actions).

3. Credentials

For a detailed guide on how to obtain and configure credentials, please refer to our official documentation: Credential Configuration Guide.

4. Supported Operations

Summary

This Github node primarily operates on core resources such as files, issues, releases, repositories, code reviews, and workflows. The following table summarizes all supported operations:

Resource Operation Description
File Create a File Creates a new file in a specified GitHub repository.
File Delete a File Deletes a committed file from a GitHub repository.
File Edit a File Updates the content of an existing file in a GitHub repository.
File Get a File Gets the content of a committed file in a GitHub repository.
File List Files Lists all files in a specified branch of a GitHub repository.
Issue Create an Issue Creates a new GitHub issue in a specified repository.
Issue Create an Issue Comment Creates a comment on a specified GitHub issue.
Issue Edit an Issue Edits an existing GitHub issue.
Issue Get Issues of a Repository Gets the list of issues in a specified GitHub repository.
Issue Get an Issue Gets a single GitHub issue from a specified repository by its number.
Issue Lock an Issue Locks a specified GitHub issue. This action cannot be undone.
Pull Request Get Pull Requests of a Repository Gets the list of pull requests in a GitHub repository.
Release Create a Release Creates a new release in a GitHub repository.
Release Delete a Release Deletes a release from a GitHub repository.
Release Get Many Releases Gets the list of releases for a specified GitHub repository.
Release Get a Release Retrieves a single GitHub release from a specified repository by its ID.
Release Update a Release Updates an existing release in a GitHub repository.
Repository Get Repositories for a User Retrieves the list of repositories for a specified GitHub user.
Repository Get Repositories for an Organization Retrieves the list of repositories for a specified GitHub organization.
Repository Get a Repository Retrieves detailed information for a single GitHub repository.
Repository Get the License of a Repository Retrieves the license information for a specified GitHub repository.
Repository Get the Profile of a Repository Gets the community health profile for a specified GitHub repository.
Repository List Popular Paths of a Repository Retrieves the top ten most popular content paths in a GitHub repository based on traffic data.
Repository List the Top Referrers of a Repository Retrieves the top traffic referrers for a GitHub repository.
Repository Search Repository Searches for GitHub repositories using various criteria.
Review Create a Review Creates a review for a pull request in a GitHub repository.
Review Get Many Reviews Retrieves all reviews for a specific pull request in a GitHub repository.
Review Get a Review Retrieves a specific review from a GitHub pull request.
Review Update a Review Updates an existing pull request review on GitHub.
User Invite a User Invites a user to become a collaborator in a GitHub repository.
Workflow Disable a Workflow Disables a specified GitHub Actions workflow.
Workflow Dispatch a Workflow Event Dispatches a GitHub Actions event for a specified workflow to trigger its run.
Workflow Dispatch a Workflow Event Wait Dispatches a GitHub Actions workflow event and waits for its execution to complete.
Workflow Enable a Workflow Enables a specified GitHub Actions workflow.
Workflow Get a Workflow Retrieves a specific GitHub Actions workflow from a repository.
Workflow Get the Usage of a Workflow Gets the usage of a specified GitHub Actions workflow.
Workflow List Workflows Lists all GitHub Actions workflows for a specified repository.

Operation Details

Create a File

Creates a new file in a specified GitHub repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The name of the GitHub repository.
  • FilePath: The path of the new file to be created (including the filename).
  • FileContent: The content of the file to be created; it will be automatically encoded in Base64 format.
  • CommitMessage: The commit message for creating the file.

Options:

  • Branch: The target branch name; defaults to "main" if not specified.

Output:

  • Created (bool): Indicates whether the file was successfully created.
  • FileSha (string): If successful, returns the SHA value of the created file; otherwise, an empty string.
  • StatusCode (number): HTTP response code (-1 for parameter error, 500 for internal error).
  • ErrorMessage (string): Returns an error message if any error occurred; an empty string on success.

Delete a File

Deletes a committed file from a GitHub repository.

Input Parameters:

  • Owner: The username or organization name that owns the repository.
  • Repo: The name of the repository.
  • FilePath: The path of the file to delete within the repository.
  • CommitMessage: The commit message for the delete operation.

Options:

  • Branch: The branch name; defaults to 'main'.

Output:

  • Deleted (bool): Indicates whether the file was successfully deleted.
  • FileSha (string): The SHA value of the deleted file.
  • GitResponse (string): A JSON string returned by the GitHub API, containing details of the deletion or an error message.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): A description of the error if any occurred; an empty string if there were no errors.

Edit a File

Updates the content of an existing file in a GitHub repository.

Input Parameters:

  • Owner: The owner of the repository (username or organization name).
  • Repo: The repository name.
  • FilePath: The path of the file to update within the repository.
  • CommitMessage: The commit message for the update operation.
  • NewContent: The new file content (will be base64 encoded).

Options:

  • Branch: The branch where the file is located (defaults to the main branch).

Output:

  • FileUpdated (bool): Indicates whether the file was successfully updated.
  • CommitSha (string): The commit SHA value of the updated file.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message on failure, empty on success.

Get a File

Gets the content of a committed file in a GitHub repository.

Input Parameters:

  • Owner: The owner of the GitHub repository (username or organization).
  • Repo: The name of the GitHub repository.
  • FilePath: The path of the file within the repository.

Options:

  • Refer: An optional commit SHA, branch name, or tag to specify the file version. If empty, the default branch is used.

Output:

  • FileContent (string): The decoded file content fetched from GitHub.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): Details of any error that occurred, otherwise empty.

List Files

Lists all files in a specified branch of a GitHub repository.

Input Parameters:

  • Owner: The owner of the GitHub repository (username or organization).
  • Repo: The name of the GitHub repository.

Options:

  • Branch: The name of the branch to list files from, defaults to "main".

Output:

  • FileList (string-array): A JSON array representing the list of file paths in the repository.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred, empty on success.

Create an Issue

Creates a new GitHub issue in a specified repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The repository identifier, in the format 'repo'.
  • Title: The title of the issue to be created.

Options:

  • Body: The content of the issue, this is optional.

Output:

  • Issue (object): A JSON-formatted object representing the details of the created issue.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): Describes any error encountered, empty on success.

Create an Issue Comment

Creates a comment on a specified GitHub issue.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The repository name.
  • IssueNumber: The identifier of the issue to comment on.
  • CommentBody: The content of the comment.

Output:

  • Comment (object): A JSON string representing the comment object returned by the GitHub API.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): An error message if any error occurred, empty when there are no errors.

Edit an Issue

Edits an existing GitHub issue.

Input Parameters:

  • Owner: The owner of the repository (username or organization).
  • Repo: The repository name.
  • IssueNumber: The number of the issue to edit.
  • Title: The new title for the issue.

Options:

  • Body: The new content for the issue, optional.

Output:

  • UpdatedIssue (object): A JSON-formatted dictionary containing the updated issue data.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred, otherwise empty.

Get Issues of a Repository

Gets the list of issues in a specified GitHub repository.

Input Parameters:

  • Owner: The owner of the GitHub repository.
  • Repo: The name of the GitHub repository.

Output:

  • Issues (object-array): A JSON string of a list of issue objects returned by the GitHub API.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if the request fails or parameter validation errors occur; empty on success.

Get an Issue

Gets a single GitHub issue from a specified repository by its issue number.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The repository name.
  • IssueNumber: The number of the issue to retrieve.

Output:

  • Issue (object): A JSON string of the retrieved issue details.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): A description of the error if any occurred; empty on success.

Lock an Issue

Locks a specified GitHub issue. This action cannot be undone.

Input Parameters:

  • Owner: The GitHub user or organization that owns the repository.
  • Repo: The name of the repository.
  • IssueNumber: The number of the issue to lock.

Output:

  • Locked (bool): Indicates whether the issue was successfully locked.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): A description of the error if any occurred, otherwise an empty string.

Get Pull Requests of a Repository

Gets the list of pull requests in a GitHub repository.

Input Parameters:

  • Owner: The GitHub username or organization name that owns the repository.
  • Repo: The name of the repository from which to retrieve pull requests.

Options:

  • State: The state of the pull request.
  • Sort: The sort order of the pull request.
  • Direction: The sort direction.
  • PerPage: The number of results to return per page.
  • Page: The page number.

Output:

  • PullRequests (object-array): A JSON string of a list of pull request objects returned by the GitHub API.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if parameter validation fails or the API request fails, otherwise empty.

Create a Release

Creates a new release in a GitHub repository.

Input Parameters:

  • Owner: The owner of the GitHub repository.
  • Repo: The name of the GitHub repository.
  • TagName: The tag name for the release.

Options:

  • ReleaseName: The name of the release (defaults to an empty string).
  • Body: The description text of the release (defaults to an empty string).
  • Draft: Whether to create it as a draft release (defaults to false).
  • Prerelease: Whether to create it as a pre-release (defaults to false).

Output:

  • Release (object): A JSON string of the created release object returned by GitHub.
  • StatusCode (number): HTTP status code: 201 for success, other codes for errors, -1 for parameter validation failure.
  • ErrorMessage (string): A description of the error if any occurred, an empty string on success.

Delete a Release

Deletes a release from a GitHub repository.

Input Parameters:

  • Owner: The username or organization that owns the repository.
  • Repo: The name of the repository.
  • ReleaseId: The ID of the release to delete.

Output:

  • Deleted (bool): Indicates whether the release was successfully deleted.
  • StatusCode (number): HTTP status code: 201 for success, other codes for errors, -1 for parameter validation failure.
  • ErrorMessage (string): An error message if any error occurred, empty on success.

Get Many Releases

Gets the list of releases for a specified GitHub repository.

Input Parameters:

  • Owner: The username or organization name that owns the repository.
  • Repo: The name of the repository.

Output:

  • Releases (object): A JSON string of a list of GitHub release objects.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): A description of the error if any occurred, an empty string on success.

Get a Release

Retrieves a single GitHub release from a specified repository by its release ID.

Input Parameters:

  • Owner: The owner of the repository.
  • Repo: The name of the repository.
  • ReleaseId: The ID of the release to retrieve.

Output:

  • Release (object): A JSON string of the retrieved GitHub release object.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): Empty if no error, otherwise an error message.

Update a Release

Updates an existing release in a GitHub repository.

Input Parameters:

  • Owner: The owner of the repository.
  • Repo: The name of the repository.
  • ReleaseId: The ID of the release to update.

Options:

  • TagName: The new tag name for the release.
  • TargetCommitish: The commit-ish value that specifies where the Git tag is created from.
  • Name: The name of the release.
  • Body: The description text of the release.
  • Draft: Set to True to mark the release as a draft.
  • PreRelease: Marks the release as a pre-release.

Output:

  • Release (object): A JSON string representing the updated release object returned by GitHub.
  • StatusCode (number): HTTP status code: 201 for success, other codes for errors, -1 for parameter validation failure.
  • ErrorMessage (string): An error message on update failure, empty on success.

Get Repositories for a User

Retrieves the list of repositories for a specified GitHub user.

Input Parameters:

  • UserName: The GitHub username whose repositories you want to retrieve.

Output:

  • Repositories (object-array): A JSON string representing the list of repositories.
  • StatusCode (number): HTTP status code: 201 for success, other codes for errors, -1 for parameter validation failure.
  • ErrorMessage (string): Empty if no error, otherwise contains an error description.

Get Repositories for an Organization

Retrieves the list of repositories for a specified GitHub organization.

Input Parameters:

  • OrgName: The name of the GitHub organization whose repositories you want to retrieve.

Output:

  • Repositories (object-array): A JSON string of a list of repository objects returned by the GitHub API.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if the operation fails, empty on success.

Get a Repository

Retrieves detailed information for a single GitHub repository.

Input Parameters:

  • Owner: The GitHub username or organization name that owns the repository.
  • Repo: The name of the repository.

Output:

  • UniqueId (number): The unique ID of the repository.
  • Name (string): The name of the repository.
  • FullName (string): The full name of the repository, including the owner.
  • Private (bool): Whether the repository is private.
  • HtmlUrl (string): The web URL of the repository on GitHub.
  • Description (string): The repository description.
  • CloneUrl (string): The Git URL to clone the repository.
  • CreatedAt (string): The creation timestamp of the repository (ISO 8601).
  • UpdatedAt (string): The last update timestamp of the repository (ISO 8601).
  • StatusCode (number): HTTP status code: 201 for success, other codes for errors, -1 for parameter validation failure.
  • ErrorMessage (string): An error message if any error occurred; empty on success.

Get the License of a Repository

Retrieves the license information for a specified GitHub repository.

Input Parameters:

  • Owner: The owner of the repository.
  • Repo: The name of the repository.

Output:

  • LicenseInfo (object): A JSON string of the license object containing key, name, spdx_id, url, node_id.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): A description of the error if any occurred, otherwise empty.

Get the Profile of a Repository

Gets the community health profile for a specified GitHub repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The name of the repository.

Output:

  • Profile (object): A JSON string representing the repository's community health profile.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred; empty on success.

List Popular Paths of a Repository

Retrieves the top ten most popular content paths in a GitHub repository based on traffic data.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The name of the repository.

Output:

  • PopularPaths (object-array): A JSON string representing the list of popular paths.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error description, empty if no error.

List the Top Referrers of a Repository

Retrieves the top traffic referrers for a GitHub repository.

Input Parameters:

  • Owner: The GitHub username or organization name that owns the repository.
  • Repo: The name of the repository.

Output:

  • TopReferrers (object-array): A list of referrer objects in JSON format.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred; empty if the request is successful.

Search Repository

Searches for GitHub repositories using various criteria.

Input Parameters:

  • SearchQuery: A GitHub search query string using GitHub's search syntax (e.g., 'machine learning language:python stars:>100').

Options:

  • SortBy: The sort field: 'stars', 'forks', 'help-wanted-issues', or 'updated'. Leave empty for best match.
  • SortOrder: The sort order: 'desc' or 'asc'. Defaults to 'desc'.
  • PerPage: The number of results per page (1-100). Defaults to 10.
  • Page: The page number for pagination, starting from 1. Defaults to 1.

Output:

  • Repositories (object-array): A JSON list of repository objects, containing details for each repository.
  • TotalCount (number): The total number of repositories matching the search criteria.
  • IncompleteResults (bool): Whether the search results are incomplete due to a timeout.
  • StatusCode (number): HTTP status code: 200 (Success), 422 (Validation failed), 403 (Forbidden), 401 (Unauthorized), 500 (Server Error), -1 (Parameter Error).
  • ErrorMessage (string): A description of the error if the operation fails, an empty string on success.

Create a Review

Creates a review for a pull request in a GitHub repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The repository name.
  • PullNumber: The number of the pull request to review.
  • Body: The content of the review.
  • Event: The review event type, one of "APPROVE", "REQUEST_CHANGES", or "COMMENT".

Output:

  • Review (object): A JSON string of the created review object returned by GitHub.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred; empty on success.

Get Many Reviews

Retrieves all reviews for a specific pull request in a GitHub repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The repository name.
  • PullNumber: The number of the pull request from which to retrieve reviews.

Output:

  • Reviews (object-array): A JSON string representing a list of review objects returned by the GitHub API.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): A description of the error if any occurred, empty on success.

Get a Review

Retrieves a specific review from a GitHub pull request.

Input Parameters:

  • Owner: The GitHub username of the repository owner.
  • Repo: The repository name.
  • PullNumber: The pull request number.
  • ReviewId: The ID of the review to retrieve.

Output:

  • Reviews (object): A JSON object of the retrieved review.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred, empty on success.

Update a Review

Updates an existing pull request review on GitHub.

Input Parameters:

  • Owner: The name of the repository owner (user or organization).
  • Repo: The repository name.
  • PullNumber: The number of the pull request to which the review belongs.
  • ReviewId: The ID of the review to update.

Options:

  • Body: The new review comment content. If omitted or empty, event must be provided.
  • Event: The review event action. One of APPROVE, REQUEST_CHANGES, or COMMENT. If omitted or empty, body must be provided.

Output:

  • UpdatedReview (string): A JSON string of the updated review object returned by GitHub.
  • StatusCode (number): The HTTP status code of the API response; -1 for parameter error, 500 for exceptions.
  • ErrorMessage (string): An error message if any error occurred; an empty string on successful operation.

Invite a User

Invites a user to become a collaborator in a GitHub repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The name of the repository.
  • UserName: The GitHub username to invite as a collaborator.

Options:

  • Permission: The permission to grant: pull, push, admin, maintain, triage. If omitted, it defaults to the repository's default permission.

Output:

  • InvitationSent (bool): Indicates whether the invitation was successfully created.
  • AlreadyCollaborator (bool): Indicates whether the user is already a collaborator.
  • InvitationDetails (string): A JSON string of the invitation object returned by GitHub upon creation; otherwise, an empty string.
  • StatusCode (number): HTTP status code: 201 for success, other codes for errors, -1 for parameter validation failure.
  • ErrorMessage (string): An error message if any error occurred; an empty string on success.

Disable a Workflow

Disables a specified GitHub Actions workflow.

Input Parameters:

  • Owner: The GitHub user or organization that owns the repository.
  • Repo: The name of the repository.
  • Workflow: The ID (number) or filename of the workflow to disable.

Output:

  • Disabled (bool): Indicates whether the specified workflow was successfully disabled.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): An error message if validation or the request fails, otherwise empty.

Dispatch a Workflow Event

Dispatches a GitHub Actions event for a specified workflow to trigger its run.

Input Parameters:

  • Owner: The GitHub username or organization that owns the repository.
  • Repo: The name of the repository.
  • Workflow: The filename or ID of the workflow to dispatch.
  • Ref: The git reference (branch, tag) to run the workflow on.

Options:

  • Inputs: A JSON object of the input parameters for the workflow.

Output:

  • Dispatched (bool): Indicates whether the workflow dispatch request was successful.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): Details of the error if the dispatch fails, empty on success.

Dispatch a Workflow Event Wait

Dispatches a GitHub Actions workflow event and waits for its execution to complete.

Input Parameters:

  • Owner: The owner of the repository.
  • Repo: The name of the repository.
  • Workflow: The filename or ID of the GitHub Actions workflow.
  • Ref: The git reference (branch or tag) used to dispatch the event.

Output:

  • RunId (number): The ID of the triggered workflow run.
  • Status (string): The status of the workflow run (completed).
  • Conclusion (string): The conclusion of the workflow run (success, failure, etc.).
  • HtmlUrl (string): The URL to view the workflow run on GitHub.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): An error message if the operation fails, otherwise empty.

Enable a Workflow

Enables a specified GitHub Actions workflow.

Input Parameters:

  • Owner: The name of the repository owner.
  • Repo: The repository name.
  • Workflow: The ID or filename of the workflow to enable (e.g., ci.yml).

Output:

  • Enabled (bool): Indicates whether the workflow was successfully enabled.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): An error message if enabling fails or if there are parameter validation errors.

Get a Workflow

Retrieves a specific GitHub Actions workflow from a repository.

Input Parameters:

  • Owner: The username of the repository owner.
  • Repo: The repository name.
  • Workflow: The ID or filename of the GitHub Actions workflow to retrieve.

Output:

  • Workflows (object): The GitHub Actions workflow to be retrieved.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): An error message if any error occurred; an empty string on success.

Get the Usage of a Workflow

Gets the usage of a specified GitHub Actions workflow.

Input Parameters:

  • Owner: The owner of the repository.
  • Repo: The name of the repository.
  • Workflow: The ID or filename of the workflow whose usage you want to retrieve.

Output:

  • Usage (string): A JSON string representation of the workflow usage data returned by the GitHub API.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): An error message if the API request or parameter validation fails, otherwise empty.

List Workflows

Lists all GitHub Actions workflows for a specified repository.

Input Parameters:

  • Owner: The owner of the GitHub repository (username or organization).
  • Repo: The name of the GitHub repository.

Output:

  • Workflows (object-array): A JSON string array of workflow objects returned by the GitHub API.
  • StatusCode (number): The HTTP status code or operation status code (-1 for parameter error, 500 for exceptions).
  • ErrorMessage (string): A description of the error if any occurred; empty on success.

5. Example Usage

This section will guide you through creating a simple workflow to automatically create a new Issue in your GitHub repository.

Workflow Overview

A basic workflow consists of three nodes: Start -> Create an Issue -> Answer. When the workflow is triggered, it will create a new Issue in the repository you specify.

Step-by-Step Guide

  1. Add Tool Node:
    • On the workflow canvas, click the "+" sign to add a new node.
    • In the pop-up panel, select the "Tools" tab.
    • Find and select Github from the tool list.
    • In the list of supported operations for Github, click to select Create an Issue, which will add the corresponding node to the canvas.
  2. Configure the Node:
    • Click on the newly added Create an Issue node, and its configuration panel will expand on the right.
    • Credential Configuration: At the top of the panel, find the credential field. Click the dropdown menu and select your pre-configured Github credential.
    • Parameter Entry: Fill in the input parameters for the operation in detail.
    • Owner: Enter the name of the user or organization that owns the target repository. For example, go-insight.
    • Repo: Enter the name of the target repository. For example, go-insight-public.
    • Title: Enter a title for the Issue you want to create. For example, Fix Bug on Login Page.
    • Body (Optional): You can add a more detailed description for the Issue. For example, The page is unresponsive after the user clicks the login button..
  3. Run and Validate:
    • Once all required parameters are correctly filled in, the error prompt in the top right corner of the workflow canvas will disappear.
    • Click the "Run" button in the top right corner of the canvas to execute the workflow.
    • After successful execution, you can click the log icon in the top right corner to view the detailed input and output of the node. The Issue field in the output will contain the details of the newly created Issue. You can also visit your GitHub repository to confirm that the new Issue has been successfully created.

Final Workflow Display

After completing the steps above, your entire workflow is configured. After clicking "Run," a new Issue will be successfully created in your specified GitHub repository.

6. FAQs

Q: Why do I get a 403 Forbidden or 404 Not Found error when operating on a private repository?

A: This is usually due to insufficient permissions. Please check the following:

  • Credential Permissions: Ensure that the Personal Access Token (PAT) used for your GoInsight credential has sufficient scopes. For reading and writing to private repositories, the repo scope is typically required.
  • Repository Access: Confirm that your GitHub account itself has the appropriate permissions (e.g., write access) for the target repository.

Q: In the "Search Repository" operation, what format should the SearchQuery parameter be?

A: The SearchQuery parameter uses GitHub's official search syntax. You can combine multiple keywords and qualifiers for a precise search. For example, to find repositories written in Go, with more than 100 stars, and containing the keyword "goinsight", you would enter: goinsight language:go stars:>100.

Q: Do I need to Base64 encode the FileContent myself for the "Create a File" operation?

A: No. You only need to provide the raw text content in the FileContent field. The GoInsight node will automatically handle the Base64 encoding when sending the request to the GitHub API.

7. Official Documentation

For more advanced usage and detailed information about the GitHub API, please refer to the official documentation:

Github REST API Official Documentation

Was This Page Helpful?
Discussion

Leave a Reply.

Your email address will not be published. Required fields are marked*

loading...
No Results